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 (from jpeg) gives inaccurate colors #2107

Closed
4 tasks done
marklonquist opened this issue May 6, 2022 · 19 comments
Closed
4 tasks done

webp (from jpeg) gives inaccurate colors #2107

marklonquist opened this issue May 6, 2022 · 19 comments

Comments

@marklonquist
Copy link

marklonquist commented May 6, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp.Web
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp.Web version

2.0.0

Other Six Labors packages and versions

ImageSharp 2.1.1

Environment (Operating system, version and so on)

Linux container in GCP running on Kubernetes

.NET Framework version

NET6

Description

Colors are inaccurate when setting format to webp from a jpeg original.

Steps to Reproduce

Set format=webp on a jpeg original in a side-by-side comparison and observe the inaccurate colors

Images

Left side: WebP - Right side: Original JPEG
Screenshot 2022-05-06 at 10 00 51

@JimBobSquarePants
Copy link
Member

JimBobSquarePants commented May 6, 2022

Wrong repository. I’ll transfer it for you

@JimBobSquarePants JimBobSquarePants transferred this issue from SixLabors/ImageSharp.Web May 6, 2022
@br3aker
Copy link
Contributor

br3aker commented May 6, 2022

Can you provide an image? It's almost impossible to determine errors just from before/after comparison.

@marklonquist
Copy link
Author

Wrong repository. I’ll transfer it for you

I was in doubt where to put it. :-) thanks for moving it.

Can you provide an image? It's almost impossible to determine errors just from before/after comparison.

This is the original:
22021778_3777410_003

@brianpopow
Copy link
Collaborator

brianpopow commented May 6, 2022

Converting to bmp and tga also has this incorrect color, while tiff seems to be ok.

I think this can have something todo with the embedded color profile.

@br3aker
Copy link
Contributor

br3aker commented May 6, 2022

Yep, checked with JPEGsnoop - this image has color profile.

@marklonquist unfortunately, this is yet to be done in #1567.

@marklonquist
Copy link
Author

Yep, checked with JPEGsnoop - this image has color profile.

@marklonquist unfortunately, this is yet to be done in #1567.

Thanks for the info.

@brianpopow
Copy link
Collaborator

There is something we can do actually: Currently we are not preserving the ICCP when encoding webp and bmp. We can at least change that.

@brianpopow
Copy link
Collaborator

With #2108, #2109 and #2110 merged to main branch, the color profile will be preserved when encoding webp, bmp and png images. With that the image color should look correct when the viewer of the image supports color profiles (most browsers should do that).

@marklonquist
Copy link
Author

That's awesome - any idea if there will be a 2.1.2 update where this might be in, or is this gonna be part of 3.0.0? 😄 Awesome work you guys are doing!

@JimBobSquarePants
Copy link
Member

Thanks!

3.0.0 I’m afraid. Only super critical security issues will be back ported to 2x now. It’s too much effort to maintain multiple majors.

@jaddie
Copy link

jaddie commented Jun 3, 2022

Wait V2 has only just come out and its already going to end up with rather critical bugs in it like this that basically render the use of webp pointless? This is a bit of a shame as Umbraco has just in V10 which is about to be released upgraded to V2 of ImageSharp & now its going to have a defective webp implementation all the way until V3 comes out presumably?

Apologies if I am being daft & missing something!

@JimBobSquarePants
Copy link
Member

JimBobSquarePants commented Jun 3, 2022

It’s not a critical bug. Color profiles are optional.

We don’t want to support legacy target frameworks. It’s a ton of work that we don’t get paid to do nor are obligated in any way to do.

@br3aker
Copy link
Contributor

br3aker commented Jun 3, 2022

Apologies if I am being daft & missing something!

You can backport it to v2.0 if you need/want to.

@jaddie
Copy link

jaddie commented Jun 3, 2022

So what needs to be done to fix the bug in ImageSharp that means its not generating the webp image correctly, an example case as attached:
New folder (3).zip

The webp file in there, is generated at a width of 1500px from a webp file as the source by ImageSharp.
The jpg file in there is also generated from the same source webp file by ImageSharp but when doing this the bug isn't occurring with ImageSharp's output & the colours of the image are as expected instead of being washed out.

Hopefully that makes sense, based on this and the test case, is this a configuration issue of some sort that can be resolved or some way to fix it if its a bug in ImageSharp's generation of the image as having a media gallery site running on Umbraco powered by this & this outcome is a bit concerning 🙈

@jaddie
Copy link

jaddie commented Jun 3, 2022

Just to put a note here in case it helps anyone else, albeit not an ideal solution, in the mean time it seems that V3 does not suffer this issue, for any Umbraco users, if you upgrade your own project to the pre-release V3 of ImageSharp while still using ImageSharp.Web 2, the site will work fine and load but without this bug happening, hope that helps someone out! 👌

@JimBobSquarePants
Copy link
Member

That is not a wise solution. There is guaranteed breaking changes to V3 including license changes.

You can follow PRs linked to this issue to see required changes. If you want to put the effort in, we’ll accept that, otherwise this is just unhelpful noise.

@marklonquist
Copy link
Author

Just out of curiosity; what kind of license changes? Anything us business users need to be aware of?

@JimBobSquarePants
Copy link
Member

Nothing. Because business users should be buying commercial licenses

@JimBobSquarePants
Copy link
Member

Fixed in v3 alpha

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

5 participants