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

Webp images are being processed and come out 10x larger #1975

Closed
thomas-gregg-bz-agency opened this issue Jan 26, 2023 · 6 comments
Closed

Comments

@thomas-gregg-bz-agency
Copy link

public void AutoOrient(Stream source, Stream dest)

As per the title when we upload an image in webp format, the resulting image comes out roughly 10 times bigger. We have not seen this for other image formats

@tidyui
Copy link
Member

tidyui commented Jan 27, 2023

Could you try asking the same question at the https://github.com/SixLabors/ImageSharp repo as we have no control over what happens inside the actual image processing. The current version of Piranha uses the latest released version of ImageSharp (2.1.3) but maybe there is a bug on their side related to this.

If you open an issue there, please reference this issue and make sure to include the code that seems to do the faulty processing, i.e:

using (var image = Image.Load(source, out IImageFormat format))
{
    image.Mutate(x => x.AutoOrient());
    image.Save(dest, format);
}

A workaround would be to remove the default registration in App.MediaTypes.Images and add it back with image processing disable with

App.MediaTypes.Images.Add(".webp", "image/webp", false);

@thomas-gregg-bz-agency
Copy link
Author

thomas-gregg-bz-agency commented Jan 30, 2023 via email

@thomas-gregg-bz-agency
Copy link
Author

@tidyui I have raised an issue over at ImageSharp and they have referenced a couple of other issues that seem to resolve the issue. Is there something that needs to be done like defining the encoding configuration?

@tidyui
Copy link
Member

tidyui commented Aug 28, 2023

Hi there! As far as I know this bug has been fixed in ImageSharp 3.x, which has a different licensing model. We will need to look into if this model can be used from an open source library without impacting users of the library.

Best regards

@karl-sjogren
Copy link

Sounds like this was the bug with lossless encoding (since no quality was specified when saving). It was backported to 2.x in https://github.com/SixLabors/ImageSharp/releases/tag/v2.1.4 so just updating to that (or rather 2.1.6 which has some security fixes as well) should solve this.

@tidyui tidyui self-assigned this Mar 14, 2024
@tidyui
Copy link
Member

tidyui commented Mar 14, 2024

Fixed in commit be0c6da

@tidyui tidyui closed this as completed Mar 14, 2024
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