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

PNG Input + withMetadata() + .webp() = Input file is missing or of an unsupported image format #1242

Closed
igorescobar opened this issue May 29, 2018 · 9 comments

Comments

@igorescobar
Copy link

igorescobar commented May 29, 2018

Hi!

I'm trying to convert a png file to webp but seems like when I add the withMetadata to the mix I get the Input file is missing or of an unsupported image format. Any idea why it happens?

To reproduce:

// use a PNG image
sharp(image)
  .web()
  .resize(100)
  .withMetadata()
  .toBuffer()
  .then(...)

If I remove the withMetadata() it works fine.

Worth mentioning that If I don't call .resize or any other operation... no error is raised but it output is a blank image.

PS: JPEG Images works fine.
PS: Tested on sharp 0.20.2 and 0.20.3.

@lovell
Copy link
Owner

lovell commented May 30, 2018

Hello, thanks for the report. It seems to only affect WebP+metadata output where pre-multiplication occurred, e.g. resizing an image with an alpha channel. I'll be able to take a closer look in a few days.

@lovell
Copy link
Owner

lovell commented Jun 2, 2018

This was due to a bug in libvips - see https://github.com/jcupitt/libvips/pull/989

I expect v0.21.0 of sharp to provide an updated version of libvips that will include this fix.

@igorescobar
Copy link
Author

igorescobar commented Jun 2, 2018

@lovell thanks so much for your help and for quickly fix the problem on the libvips project.

@igorescobar
Copy link
Author

igorescobar commented Jun 6, 2018

@lovell You guys have an estimative on the release date of this fix?

@lovell
Copy link
Owner

lovell commented Jun 6, 2018

@igorescobar libvips can be compiled from source and then sharp compiled against that if you need bleeding edge features/fixes such as this.

@igorescobar
Copy link
Author

@lovell Sure, that's fine, I was just wondering... Thanks.

@joehoyle
Copy link

joehoyle commented Sep 3, 2018

@lovell I'm assuming you don't bump the libvips build with patch versions of sharp? This bug has existed for just over 3 months, so wondering what the approach is to rolling libvips updates? Does it require that there's other functionality in sharp to warrant a minor version bump?

@lovell
Copy link
Owner

lovell commented Sep 3, 2018

sharp v0.20.x all require libvips v8.6.1+

The next bump of the prebuilt libvips will occur with the forthcoming sharp v0.21.0, probably the forthcoming libvips v8.7.0.

@lovell
Copy link
Owner

lovell commented Oct 4, 2018

sharp v0.21.0 is now available with a prebuilt libvips v8.7.0 that contains the upstream fix.

@lovell lovell closed this as completed Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants