imaginary icon indicating copy to clipboard operation
imaginary copied to clipboard

Color profile being stripped when converting from JPEG to WebP even with both noprofile and stripmeta are false

Open arthow4n opened this issue 6 years ago • 0 comments

Steps to Reproduce:

  1. docker run -it -p 9000:9000 h2non/imaginary -enable-url-source (the image version is h2non/imaginary:1.0.15)
  2. Compare the result of http://127.0.0.1:9000/convert?url=https://webkit.org/blog-files/color-gamut/Italy-P3.jpg&type=png and http://127.0.0.1:9000/convert?url=https://webkit.org/blog-files/color-gamut/Italy-P3.jpg&type=webp.
    • Also see other example images in https://webkit.org/blog-files/color-gamut/

Expected Result

The converted WebP image should keep color profile with it unless given stripmeta=true or noprofile=true.

Actual Result

The converted WebP image loses saturation due to lost of embedded color profile.

Solution

I tried to go build locally on my Mac (brew insatlled with newer dependencies) and didn't ran into the issue above. After some investigation, I came into the conclusion that there's something wrong in older versions of libvips, libjpeg-turbo or libwebp that comes with the ubuntu:16.04's apt repository. So I tried to build a image myself with newer dependencies injected. https://github.com/arthow4n/sharp-libvips/blob/v8.6.3/build/lin.sh#L18 (forked from lovell/sharp-libvips as it only have v8.6.1 built, I'm not pretty sure whether the problem will happen with v8.6.1 or not) https://github.com/arthow4n/imaginary/blob/bundle-libvips-v8.6.3/Dockerfile#L71 The result image for the purpose of demonstration is arthow4n/imaginary:included-libvips-8.6.3-upstream-e558c55 which can be pulled from Dockerhub. The problem happens no more by replacing the image used in Steps to Reproduce with it.

I suggest injecting newer dependencies into the image instead of using older ones that come with the distribution repository.

arthow4n avatar Jun 10 '18 12:06 arthow4n