Expand description
ICC color profile handling for accurate metric calculation.
This module provides ICC profile transformation to ensure images are in sRGB color space before computing perceptual quality metrics.
§Why ICC Profiles Matter
When comparing image quality, both images must be in the same color space. Many encoded images (especially XYB JPEGs from jpegli) embed non-sRGB ICC profiles. Without proper color management:
- Metrics will report incorrect scores
- SSIMULACRA2 can be off by 1-2 points (1-2% error at high quality)
- Colors may appear shifted even when compression is lossless
§Implementation Notes
This module uses moxcms, a pure-Rust CMS that most closely matches libjxl’s skcms library. According to experiments (see ssimulacra2-fork/EXPERIMENTS.md):
| CMS Backend | SSIMULACRA2 Score | Difference from skcms |
|---|---|---|
| libjxl (skcms) | 88.48 | — (reference) |
| moxcms Linear | 86.96 | -1.52 (1.7%) |
| lcms2 Perceptual | 85.97 | -2.51 (2.8%) |
The remaining gap is likely due to JPEG decoder differences, not CMS.
Enums§
- Color
Profile - Color profile information for an image.
Functions§
- prepare_
for_ comparison - Transform two images to sRGB and return them.
- transform_
to_ srgb - Transform RGB pixels from source ICC profile to sRGB.