Test parsing all R2-hosted ICC profiles across all CMS backends
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
We have a corpus of 29 grayscale + 63 RGB ICC profiles from real-world images, hosted on S3/R2. These should be tested across all CMS backends (moxcms, lcms2, and any future backends) to catch parsing failures, transform divergences, and regressions.
## How to fetch the test assets
### Option 1: `codec-corpus` crate (recommended for CI)
The [`codec-corpus`](https://crates.io/crates/codec-corpus) crate provides lazy download + caching of test datasets. Add to `[dev-dependencies]`:
```toml
codec-corpus = "1.1"
```
Then fetch the grayscale ICC gradient JPEGs:
```rust
let corpus = codec_corpus::Corpus::new().unwrap();
// Fetch from arbitrary S3 URL into local cache
let gray_dir = corpus.zip_url(
"grayscale-icc-fixtures",
"https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/grayscale_icc.zip"
).unwrap();
```
Or fetch individual files directly:
```rust
let url = "https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/grayscale_icc/gray_gamma_1_8.jpg";
// Use ureq/reqwest to download, cache in ~/.cache/codec-corpus/
```
### Option 2: Direct S3 URLs
All gradient JPEGs (256×1, pixel[x]=x, Q100 baseline) at:
```
https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/grayscale_icc/.jpg
```
Full fixture list (30 files, ~48 KB total):
- `no_icc_baseline.jpg` — control (no ICC profile)
- `gray_gamma_2_2_simple.jpg`, `gray_gamma_2_2_expanded.jpg`, `gray_gamma_2_2_curv1024.jpg`, `gray_gamma_2_2_curv1024_v2.jpg` — Gamma 2.2 variants
- `gray_gamma_1_8.jpg`, `epson_gray_gamma_1_8.jpg`, `sgray_artifex_gamma_1_8.jpg`, `generic_gray_profile_0faa32c0.jpg`, `generic_gray_profile_10233312.jpg`, `generic_gray_profile_94722fe2.jpg`, `generic_gray_profile_macOS.jpg`, `windows_blackwhite.jpg` — Gamma 1.8 variants
- `sgrey_v4.jpg`, `sgrey_v2_nano.jpg`, `sgrey_v2_micro.jpg`, `sgrey_v2_magic.jpg`, `with_srgb_trc.jpg`, `default_gray_artifex.jpg` — sRGB TRC
- `ps_gray_linear.jpg`, `gray_linear.jpg` — Linear (gamma 1.0)
- `calibrated_gray.jpg` — Apple Calibrated Gray
- `dot_gain_10.jpg`, `dot_gain_15.jpg`, `dot_gain_20.jpg`, `dot_gain_20_curv256.jpg`, `dot_gain_20_variant.jpg` — Dot Gain
- `gray_cie_l.jpg` — **Lab PCS** (fails in moxcms)
- `iso_newspaper26v4.jpg`, `wan_ifra_newspaper26v5.jpg` — **Lab PCS printer class** (fails in moxcms)
### Option 3: Raw ICC profiles (no JPEG wrapping)
The raw `.icc` files live in `~/.cache/zenpixels-icc/` (generated by `icc-gen` from `imazen/zenpixels`). To regenerate:
```bash
cd ~/work/zen/zenpixels
just icc-gen # scans system profiles + bundled profiles → ~/.cache/zenpixels-icc/
```
## Grayscale profiles that currently fail (Lab PCS)
| Profile | Size | PCS | Class | Source |
|---------|------|-----|-------|--------|
| Gray CIE*L | 424B | Lab | `mntr` | colord/Oyranos (Kai-Uwe Behrmann) |
| ISOnewspaper26v4_gr | 1392B | Lab | `prtr` | LOGO GmbH |
| WAN-IFRAnewspaper26v5_gr | 1432B | Lab | `prtr` | X-Rite |
## Known CMS divergence
moxcms vs lcms2 diverge by max=10 on linear (gamma 1.0) profiles at very dark tones (pixel #2: moxcms=22 vs lcms2=12). This is in the sRGB OETF linear-segment transition.
## Proposed test
For each profile × each CMS backend:
1. Parse the ICC profile (verify no crash/panic)
2. Create a Gray→sRGB transform
3. Transform a 0-255 gradient
4. Verify: monotonically non-decreasing output, R==G==B (neutral), alpha=255
5. Cross-check backends agree within tolerance (currently ±10 for linear, ±3 for others)
6. For Lab PCS profiles: either handle correctly or return a clear error (not panic)
## Reference implementation
See `imazen/imageflow:imageflow_core/tests/integration/visuals/grayscale_icc.rs` — 42 passing tests covering all 29 profiles through the moxcms + lcms2 Both-mode pipeline.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with imazen/imageflow:imageflow_core/tests/integration/visuals/grayscale_icc.rs and review the proposed corpus-loading approach using codec-corpus or the listed S3 URLs. Add coverage for each profile across the CMS backends, checking parsing, Gray→sRGB gradients, neutrality, alpha, tolerance, and clear handling of Lab PCS profiles; run the integration tests to verify the expected results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100