dlemstra / dlemstra/Magick.NET
JPEG XL: Output color mismatch on files with embedded CICP instead of ICC
- Dominant language
- C#
- Stars
- 4k
- Forks
- 451
- Avg merge
- 11h 55m
- Merged PRs (30d)
- 3
Description
### 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.

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](https://drive.google.com/file/d/1ZBwxI_ouiDXgNeI7oAx81Bzv2NzuYNgS/view?usp=share_link) - google drive
1. Download the jxl files above
2. Open in ImageGlass and observe the differences
Contributor guide
Assessment
This issue has not been assessed yet.