question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Error: Input buffer contains unsupported image format" for some remote images

See original GitHub issue
var resizer = sharp().resize( 300, 300 ).withoutEnlargement().max().toFile( 'public/img_thumbs/' + thumb_name, ( err, info ) =>
{
       console.log( err );
});

request( url ).pipe( resizer );

Any idea why I’m getting “Error: Input buffer contains unsupported image format” for remote images like these?

https://scontent.fsof3-1.fna.fbcdn.net/v/t1.0-9/34457169_729308874126794_510102304989380608_n.jpg?_nc_cat=0&oh=fec2a8806865bcbe2009a7a8108f543d&oe=5BAE65A5

https://i.redditmedia.com/xqXYvpuqZNxcLleQ-xQvT09_oLNiUuXi9RHTP6q15r8.jpg?fit=crop&crop=faces%2Centropy&arh=2&w=960&s=86914a55b26ff161fd02d0491f798438

I realize that maybe it’s more of a request module issue but I can’t figure out how to fix it specifically with sharp, besides the request response.headers[‘content-type’] returns correctly “image/jpeg”.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
jeffminsungkimcommented, Nov 13, 2019

@pig-cop Could you share how you actually solved it? I’m having the same issue.

10reactions
pig-copcommented, Jun 7, 2018

I solved it and it was the craziest thing! Those url strings, coming from html input forms, had url encoded ampersands!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sharp Error: Input buffer contains unsupported image format
I found the solution. const getImage = (req, res, next) => { const w = parseInt(req.params.w) const readStream = s3 .
Read more >
Input buffer contains unsupported image format - Help
I have a problem with generating features and there is this Error: Input buffer contains unsupported image format. My Images are in jpg ......
Read more >
Error: Input buffer contains unsupported image format
The error about the unsupported image format is referring to the fact that the words you are adding to the training data aren't...
Read more >
Error: Input buffer contains unsupported image format ...
Coding example for the question Error: Input buffer contains unsupported image format when trying to use Next JS next-optimize-image-node.js.
Read more >
Error "gatsby-plugin-manifest" Input file contains ...
I'm getting an unsupported image error when trying to deploy my Gatsby site to Netlify. The error is from the gatsby-plugin-manifest, see screenshot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found