Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

JPEG XL: Output color mismatch on files with embedded CICP instead of ICC #1296

Open
kampidh opened this issue Nov 9, 2022 · 3 comments
Open

Comments

@kampidh
Copy link

kampidh commented Nov 9, 2022

Magick.NET version

12.2.0

Environment (Operating system, version and so on)

Windows 10 Pro 21H2 64bit

Description

Possibly related to #1212 but minus the crash and more focused on how Magick.NET handles different color profiles in JXL.

I am using a recent version of ImageGlass Kobe v8.7.11.6 x64 which uses Magick.NET 12.2.0.
So JXL currently have 2 ways in describing the color profile, with embedded CICP-styled enum or ICC profile. I tried both methods and notices that IG displayed them differently.

ig-cicp-icc-2
Left one uses CICP and right one uses ICC, both are encoded lossless in JXL.
The color profile used is Rec.2020 with linear TRC.

It seems like the CICP got discarded and applied as a standard sRGB instead.
However after further investigation, I tried magick identify -verbose to both images and here's the result on Profiles info:

  • ICC version:
Profiles:
    Profile-icc: 1384 bytes
  Properties:
    date:create: 2022-11-09T08:12:18+00:00
    date:modify: 2022-11-09T08:10:26+00:00
    date:timestamp: 2022-11-09T17:39:34+00:00
    icc:copyright: Copyright 2016, Elle Stone (http://ninedegreesbelow.com/), CC-BY-SA 3.0 Unported (https://creativecommons.org/licenses/by-sa/3.0/legalcode).
    icc:description: Rec2020-elle-V2-g10.icc
    icc:manufacturer: Rec2020 chromaticities from https://www.itu.int/dms_pub/itu-r/opb/rep/R-REP-BT.2246-2-2012-PDF-E.pdf; https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-2-201510-I!!PDF-E.pdf
    signature: c2f1933cc5a077c49da89ef7249a9bd5247f053d359712eb9f4d0382ccbb652b
  • CICP version:
Profiles:
    Profile-icc: 732 bytes
  Properties:
    date:create: 2022-11-09T08:12:18+00:00
    date:modify: 2022-11-09T08:09:57+00:00
    date:timestamp: 2022-11-09T17:39:32+00:00
    icc:copyright: Copyright 2019 Google LLC, CC-BY-SA 3.0 Unported license(https://creativecommons.org/licenses/by-sa/3.0/legalcode)
    icc:description: RGB_D65_202_Per_Lin
    signature: c2f1933cc5a077c49da89ef7249a9bd5247f053d359712eb9f4d0382ccbb652b

As we can see that ImageMagick (7.1.0-52 Q16-HDRI x64) can retrieve the correct synthetic profile created by JXL's decode. This is further proven that when converting them back to PNGs with magick, the displayed output and color profiles are identical.

The only difference is that the synthetic profile from CICP is on v4 spec, while the ICC one is on v2 spec. This doesn't seem the case though, since ImageGlass can display other images (like PNG) with v4 ICC profiles correctly. So I presume the profile isn't passed properly on Magick.NET.

Steps to Reproduce

JXL files used along with the raw PNG - google drive

  1. Download the jxl files above
  2. Open in ImageGlass and observe the differences
@dlemstra
Copy link
Owner

Attaching file here: jxldebug.zip

@dlemstra
Copy link
Owner

Not sure what is happening but this looks like an issue in ImageGlass. I am getting the same output for both input images when I convert the two .jxl files to another format. I used the latest version 12.2.1 but I don't think anything recently changed that would explain the difference.

@kampidh
Copy link
Author

kampidh commented Nov 12, 2022

Passing this back here d2phap/ImageGlass#1447 (comment)

Seems like we can't determine the problem there either, tried IG 9.0 beta 2 only fixes the TRC / gamma, but color primaries are still reassigned back to sRGB and ended up looking desaturated.

Maybe something to do with SystemDrawing instead? Since the file conversion to other formats works fine.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants