CICP profile not extracted from PNG gAMA chunk
This happens in image from git on commit 9ad43485 (after v0.25.8 release)
Expected
The test files in tests/images/png/16bpc all have linear gamma indicated by the gAMA chunk. You can confirm that with imagemagick using the identify command and also with the online PNG chunk inspector: https://www.nayuki.io/page/png-file-chunk-inspector
I expect calling image.color_space() to indicate linear color.
Actual behaviour
This is what I actually get when I load the image and dbg!(image.color_space());
image.pixels.color_space() = Cicp {
primaries: SRgb,
transfer: SRgb,
matrix: Identity,
full_range: FullRange,
}
That is, the image is still considered sRGB (gamma 0.45455) while the embedded chunk clearly indicates linear light (gamma 1.0).
Reproduction steps
image::open("tests/images/png/16bpc/basn2c16.png").unwrap();
`dbg!(image.color_space());
Do we populate the correct CICP even if the PNG directly contains an cICP chunk? IIRC loading color spaces from files was still fully unimplemented
I don't actually know, I don't have a PNG file with a cICP chunk to test it.
I don't actually know, I don't have a PNG file with a cICP chunk to test it.
If you'd like to have some, one way to make them is with ffmpeg. (Note: the following command just changes CICP tags.)
ffmpeg -color_primaries bt2020 -color_trc smpte2084 -i input.png output.png
Small example:
(Loading this image with latest image produces the incorrect Cicp { primaries: SRgb, transfer: SRgb, matrix: Identity, full_range: FullRange }, while ffprobe reports rgb24(pc, gbr/bt2020/smpte2084), and xxd output confirms CICP=9/16/0/1:
00000030: 0100 8479 1773 0000 0004 6349 4350 0910 ...y.s....cICP..
00000040: 0001 4d23 23fe 0000 0020 6348 524d 0000 ..M##.... cHRM..