Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Image input not supported, even though i am giving image/jpeg file #4285

Open
Saurabh9678 opened this issue Nov 26, 2024 · 3 comments
Labels

Comments

@Saurabh9678
Copy link

What are you trying to achieve?

I am trying to implement sharp on my backend system, when i want to create thumbnail for images [jpeg, jpg,png]
I will be attaching the code section below, i have used mime-type to verify my file, mime lookup gives value of image/jpeg
and the file exist for sure. but still its giving me image input not supported, what is the possible issue?

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question

                await sharp(filePath).resize(200, 200).toFile(thumbnailPath,(err,info)=>{
                    if(err){
                        console.log("Error in generating thumbnail",err);
                    }else{
                        console.log("Thumbnail generated successfully",info);
                        thumbnailgenerated = true;
                         }
                    }
                );
@Saurabh9678
Copy link
Author

Saurabh9678 commented Nov 26, 2024

this is the error i am getting, what are the possible reasons?
and how to debug?

Error in generating thumbnail Error: Input file contains unsupported image format
at Sharp.toFile (/Users/saurabh/Desktop/daakia-backend-nodejs/node_modules/sharp/lib/output.js:90:19)
at uploadChatAttachmentFileToAzure (/Users/saurabh/Desktop/daakia-backend-nodejs/middlewares/uploadToAzure.js:153:60)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Middleware_Common_Object.<anonymous> (/Users/saurabh/Desktop/daakia-backend-nodejs/middlewares/uploadToAzure.js:233:30)

@QAtestingin

This comment was marked as off-topic.

@lovell
Copy link
Owner

lovell commented Nov 28, 2024

uploadChatAttachmentFileToAzure

Please ensure there are no networking-related errors or race conditions in your code. If you're still having problems, please provide a sample image that allows someone else to consistently reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants