ImageMagick / ImageMagick/ImageMagick

ImageMagick discards color profile when encoding JXL with quality < 100

Open
#8,735 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.5k
Forks
1.7k
Avg merge
10h 17m
Merged PRs (30d)
28

Description

ImageMagick version

7.1.2-22

Operating system

MacOS

Operating system, version and so on

macOS Tahoe 26.4.1

Description

Because JPEG XL exports are currently broken in Lightroom Classic, I exported a TIFF file from it so I could process it further using ImageMagick. (a resized version of that file is attached below as test_hdr.tif.zip)

Converting it to JXL with quality=100 works just fine, but as soon as the quality level is not 100 anymore, ImageMagick silently discards the color profile that I explicitly extracted from the input file in a first step and told it to use in the second step.

Steps to Reproduce

Extract the color profile from the input image:

convert test_hdr.tif test_hdr.icc

First, convert the input image to JXL at quality level 100:

magick test_hdr.tif -quality 100 -depth 16 -filter Triangle -resize 6000x6000> +profile '*' -profile test_hdr.icc -define precision:highres-transform=true -define jxl:effort=11 -define jxl:decoding-speed=0 test_hdr_100.jxl

At this point, the input and output images should look the same.

Then, lower the quality level to anything that's not 100:

magick test_hdr.tif -quality 75 -depth 16 -filter Triangle -resize 6000x6000> +profile '*' -profile test_hdr.icc -define precision:highres-transform=true -define jxl:effort=11 -define jxl:decoding-speed=0 test_hdr_75.jxl

The output image is now free of any colorspace information. What should be using an HDR colorspace is now interpreted as sRGB and looks wrong and super washed out as a result.

I found this issue from last year that's about another colorspace-related issue with the JXL encoder, but the quality==100 check mentioned in the linked comment feels relevant.
Alas, I'm not a C programmer, so I'm not gonna play around with that.

Images

test_hdr.tif.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied test_hdr.tif and the two magick commands, comparing quality 100 with quality 75. Trace the JPEG XL encoder's color-profile handling around that quality difference. Done means the explicitly supplied ICC profile is retained and the lower-quality JXL output is interpreted in the intended HDR colorspace.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.