# ICJ108 Color Measurements (i1Pro 2) Measure CIELab values from colors printed on opaque white using ArgyllCMS, average repeated scans, and relate results to ink mix formulas. ## Quick start (automated workflow) ```bash ./auto-scan.sh ``` `auto-scan.sh` runs the whole process in one go: 1. **Checks required software** — verifies `python3` and ArgyllCMS (`spotread`) are available. Installs python3 (via `apt` on Linux or Homebrew on macOS) and downloads ArgyllCMS to `~/.local/bin` automatically if missing. 2. **Waits for the instrument** — prompts you to connect the i1Pro 2 via USB and re-checks until it is detected. 3. **Scans the samples** — lists the sample names from `samples.txt` in measurement order, then starts `spotread`. You first calibrate on the white tile, then take one reading per sample with the instrument button. After each reading the terminal prints the **next sample code** so you know which one to scan next; press **Q** when all readings are done. If the number of readings doesn't match `samples.txt`, the scan can be discarded to `archive/` and repeated. 4. **Saves a labelled CSV** — converts the spotread TSV log to `scan__.csv` with a `sample_id` column taken from `samples.txt`. 5. **Updates the averages** — re-averages **all** complete scan CSVs in the folder into `averaged.csv` (L\*, a\*, b\* mean and standard deviation per sample, plus a `dE00` CIEDE2000 column against each sample's named reference) and a formatted `averaged.html` view, then asks whether to rebuild the formula table `formula.csv` (default: yes). ### Options ```bash ./auto-scan.sh # D50 Lab (default) ./auto-scan.sh M0 # ISO 13655 M0 ./auto-scan.sh M1 # ISO 13655 M1 ./auto-scan.sh M2 # ISO 13655 M2 (UV cut) ./auto-scan.sh --average-only # no scanning; just rebuild averaged + formula CSVs ./auto-scan.sh --help # usage ``` Note: scans made in different modes are kept separate; the averaged file is built only from scans of the mode you pass (default D50). ## Prerequisites ### Operating system The scripts run on **Linux** and **macOS**: - **Linux** — the primary target. Uses `apt` to install python3 if missing and udev rules for USB access (see below). Ships bash 4+. - **macOS** — supported. The default `/bin/bash` is 3.2, so `auto-scan.sh` is written to stay compatible with it; no newer bash is required. python3 is installed via [Homebrew](https://brew.sh) if missing, and ArgyllCMS uses the macOS build (runs under Rosetta 2 on Apple Silicon). macOS needs no udev rules. Note: only the desktop workflow is verified on Linux; the macOS paths are portability fixes and have not been hardware-tested. - **Windows** — not supported (no Bourne shell / udev; use WSL instead). ### Other requirements - bash, python3 (auto-installed if missing) - ArgyllCMS (auto-downloaded to `~/.local/bin/Argyll_V3.4.1` if missing) - X-Rite i1Pro 2 with its white calibration tile - (Linux only, recommended, one time) udev rules so the instrument works without root: ```bash sudo ./setup-udev.sh # then unplug and replug the i1Pro 2 ``` ## Sample list `samples.txt` defines the sample names, one per line, in measurement order. This file is **not tracked in git** (it holds your specific material codes); copy the template to create your own: ```bash cp samples.example.txt samples.txt ``` Lines starting with `#` are comments. Lines starting with `note:` are metadata shown above the table in `averaged.html` (not samples). Material names can be any codes. Append ` > REF` to measure that sample's `dE00` against another sample; a bare name (no `>`) is itself a **reference**. Mix samples use the pattern `NAME_A+NAME_B[w1 to w2 mix]`, e.g.: ```text note: Glaze: CPO1192 INK_A INK_B > INK_A INK_A+INK_B[75 to 15 mix] > INK_A INK_A+INK_C[30 to 80 mix] > INK_A ``` The weights are converted to percentages in the formula table (e.g. `30 to 80` → 27% / 73%), which adds one column per material and discovers the material names automatically from your sample list. ## Output files | File | Contents | |------|----------| | `scan_D50_.tsv` | Raw spotread log (Lab + XYZ + spectrum 380–730 nm) | | `scan_D50_.csv` | Same data as CSV with `sample_id` column | | `averaged.csv` | Per-sample L\*, a\*, b\* mean and std, plus `dE00` vs each sample's reference | | `averaged.html` | Formatted view of `averaged.csv` with color swatches | | `formula.csv` | Averaged Lab plus one percentage column per ink | | `archive/` | Discarded or superseded scans | ## Individual tools These are used by `auto-scan.sh` but can also be run on their own: | Script | Purpose | |--------|---------| | `measure.sh [mode]` | Just the spotread measurement session (TSV output) | | `run-measurement.sh [mode]` | Measurement session + CSV conversion | | `prompt-next-sample.py -s samples.txt -- spotread …` | Wrap spotread and print the next sample code after each reading | | `tsv-to-csv.py [-s samples.txt]` | Convert a spotread TSV to labelled CSV | | `average-results.py -o out.csv` | Average Lab across scan CSVs (writes CSV + HTML) | | `build-formula-table.py` | Rebuild `formula.csv` from the averaged CSV | | `rebuild-average.sh` | Shortcut for `./auto-scan.sh --average-only` | | `setup-udev.sh` | Install udev rules for USB instrument access (sudo) | ## Measurement tips - Calibrate at the start of each session; recalibrate (press `k` in spotread) if the ambient temperature changes. - Keep the instrument flat on the sample and fully covering the aperture. - Wait ~15 s after calibration before the first reading for best repeatability. - If repeatability degrades, check for i1Pro lamp drift: `spotread -Y L -O /dev/null`, then let the instrument cool a few minutes.