feat(bin): add ICC color profile handling for still images#31
Conversation
|
Heads up on the two red checks: I dug into both and they're pre-existing on msrv job runs on Rust 1.65.0, but the binary that got merged in build job dies on Happy to push a fix for either in this PR if you'd like (bump the msrv job to match the bin's 1.74, regenerate the MSRV lock, add a |
|
Sorry for the delay on reviewing this. Looks like I finally got the CI job passing after cleaning up a year of decay. |
|
I'm guessing this needs a rebase. I swear Github used to have a button so I could do it, but I don't seem to have it available. |
Read embedded ICC profiles from PNG (iCCP chunk) and JPEG (APP2 markers) and convert to sRGB via lcms2 before computing the metric, matching the C++ libjxl ssimulacra2 binary behavior. Adds --no-icc flag to bypass conversion. Also handles alpha via dual-background compositing (0.1/0.9).
b832ecd to
c631ef3
Compare
Summary
iCCPchunk) and JPEG (APP2 markers) and convert pixels to sRGB vialcms2before computing the metric. This matches the C++ libjxl ssimulacra2 binary's behavior on tagged inputs (Display P3, Adobe RGB, etc).--no-iccflag to disable conversion (reproduces previous behavior).imagecrate (assuming sRGB) for formats where ICC extraction isn't supported (WebP, HDR, EXR, etc).New dependencies
lcms2 = "6.1"— ICC color management (bundles liblcms2 source, no system dep needed)png = "0.17"— PNG decoding with ICC profile accessjpeg-decoder = "0.3"— JPEG decoding with ICC profile accessTest plan
cargo clippy -- -D warningsclean--no-iccbypasses conversion, reference score pinning for Display P3 and Adobe RGB