Skip to main content

Module icc

Module icc 

Source
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 BackendSSIMULACRA2 ScoreDifference from skcms
libjxl (skcms)88.48— (reference)
moxcms Linear86.96-1.52 (1.7%)
lcms2 Perceptual85.97-2.51 (2.8%)

The remaining gap is likely due to JPEG decoder differences, not CMS.

Enums§

ColorProfile
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.