image icon indicating copy to clipboard operation
image copied to clipboard

Write CICP profile to files

Open 197g opened this issue 3 months ago • 2 comments

Follow up on #2531 where we have an attribute in each ImageBuffer and DynamicImage that denotes the color space of the buffer as CICP information. When we write such images to a file, we should include that metadata into the output as a CICP profile of an equivalent ICC profile. Encoder's ability to do so is tracked in #2493 (for some formats exif in #2494 could be applicable).

197g avatar Aug 27 '25 12:08 197g

Support for cICP in PNG seems to be still too weak and inconsistent.

For example, Firefox doesn't seem to be applying gamma curve from the cICP chunk, but the presence of the chunk makes it ignore the gAMA fallback.

kornelski avatar Aug 30 '25 01:08 kornelski

We'll need to add support for transparently loading CICP profiles before we start writing them back to files. Otherwise we'd end up pretty much just writing "unknown" or "sRGB" regardless of the input color space.

We also probably want to track whether loaded images had no color space (so we can assume sRGB) or if the had a specified color space via ICC profile or some other way we don't yet support (in which case we can guess the color space isn't sRGB and we shouldn't write any CICP chunk).

fintelia avatar Aug 30 '25 18:08 fintelia