Skip to main content

Module icc_profiles

Module icc_profiles 

Source
Expand description

Embedded CC0-licensed ICC profiles for common wide-gamut color spaces.

The four compact constants are from Compact-ICC-Profiles by Clinton Ingram, released under the CC0 1.0 Universal public domain dedication. They are embedded at compile time via include_bytes!(). The full icc-db CICP database is generated separately; it is not this collection of compact constants.

§Available profiles

ConstantColor spaceFormatSizeTRC form
DISPLAY_P3_V4Display P3ICC v4480 bytesparaType-3 sRGB
DISPLAY_P3_V2Display P3ICC v2736 bytes182-point sampled sRGB
ADOBE_RGBAdobe RGB (1998)ICC v2374 bytescurv count=1 (pure gamma)
REC2020_V4Rec. 2020ICC v4480 bytesparaType-3 BT.709

§Notes on choices

§Adobe RGB — pure gamma, not paraType-3

We deliberately bundle the saucecontrol v2 variant (curv count=1, gamma 2.19921875, no linear toe) rather than their v4 variant (paraType funcType=3 with linear toe). Rationale: surveying the in-the-wild corpus, ~85% of Adobe RGB ICC profiles encode the TRC as pure gamma (Adobe CS4 distribution, Windows ClayRGB1998 / AdobeRGB1998, macOS AdobeRGB1998, Linux AdobeRGB1998/compatibleWithAdobeRGB1998, Nikon, and per-camera profiles). The Adobe RGB 1998 encoding spec (§4.3.4.2) itself defines pure gamma with no toe. Bundling the pure-gamma form matches both the spec and the majority of the ecosystem, and means the embedded profile round-trips byte-exact against moxcms’s new_adobe_rgb() canonical reference.

§ProPhoto — not bundled

Unlike Adobe RGB, real-world ProPhoto / ROMM ICC profiles are fragmented: ~50% pure gamma 1.8, ~30% paraType funcType=3 with the ISO 22028-2 toe (c=1/16, d=1/32), some with a non-standard Apple d=1/512, one ProPhotoLin.icm with a linear TRC despite the name, and two ISO 22028-2 v4 profiles that are mAB/mBA LUTs (no rTRC at all). Picking any single “canonical” ProPhoto profile to embed would misrepresent the other variants. Instead we leave ProPhoto un-accelerated: callers handing us a ProPhoto ICC profile fall through to full CMS so the exact encoded curve is honored.

§Display P3 / Rec. 2020 — compact constants, not what synthesis emits

The DisplayP3Compat and Rec2020Compat profiles use saucecontrol’s compatibility rebalancing: the adapted red primary’s negative Z is set to zero, with other colorants and chad adjusted to compensate. This changes the represented colorimetry, and these constants carry no cicp tag. ICC.1:2022 permits negative PCSXYZ in signed s15Fixed16Number XYZType colorant tags (and float32 multiProcessElementsType); retaining such a value is spec-conformant. Older ICC wording and reader behavior motivated the separate compatibility variants. See the linked correctness overview below. Some readers identify a gamut by colorant tags within a tolerance: our libultrahdr colorant-matching regression (0.001 tolerance) rejects DISPLAY_P3_V4 as an exact P3 match. P3 synthesis uses separately qualified compact P3/sRGB and P3/BT.709 exports in both default and no-db builds. Other database-supported pairs use the generated CICP-tagged bundle. Compatibility constants remain available for callers selecting them explicitly.

Profile format, colorimetry, precision and reader compatibility are separate checks: https://github.com/imazen/zenpixels/blob/review/first-class-lcms-20261108/docs/color-correctness-and-compatibility.md.

§Precision warnings

Rec. 2020 has a very wide gamut. Using 8-bit precision with Rec. 2020 will cause visible banding in gradients. Use 16-bit or f32 precision.

Enums§

SynthesizedIcc
Outcome of SynthesizedIcc::for_cicp — what ICC profile (if any) to embed for a CICP color description, and why there are no bytes when there aren’t.

Constants§

ADOBE_RGB
Adobe RGB (1998) Compatible ICC profile, v2 format (374 bytes, pure gamma).
DISPLAY_P3_V2
Display P3 Compatible ICC profile, v2 format (736 bytes).
DISPLAY_P3_V4
Display P3 Compatible ICC profile, v4 format (480 bytes).

Functions§

bundled_icc_profile
Get a bundled &'static ICC profile whose tone curve is exactly the requested transfer function on exactly the requested primaries.