# LithiumCMS [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](LICENSE) [![Language: C](https://img.shields.io/badge/Language-C-brightgreen.svg)](Argyll_V3.5.0/) [![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg)]() [![ICC Specification](https://img.shields.io/badge/ICC-v2.1%20%2F%20v4.4-orange.svg)](https://www.color.org/) **LithiumCMS** is a high-performance color management engine and ICC profile generator. Designed for precision prepress, digital printing, and display calibration, LithiumCMS combines mathematical color modeling with spectral measurement processing to construct accurate International Color Consortium (ICC) device profiles. In addition to standard RGB, CMY, and CMYK printing, LithiumCMS includes an active development initiative to deliver native **multichannel (5- to 7-color) Expanded Color Gamut (ECG)** profiling (such as CMYK+OGV and CcMmYK). --- ## Key Features - **High-Precision Profile Generation:** Generates ICC v2.1 and v4.4 device profiles with high-resolution forward (`AtoB`) and reverse (`BtoA`) multi-dimensional lookup tables (CLUTs). - **Regular Simplex Splines (RSPL):** Mathematical multi-dimensional scattered data interpolation engine supporting up to 10 input/output dimensions. - **Adaptive Inking & Separation:** Advanced Total Area Coverage (TAC) enforcement, Gray Component Replacement (GCR), and custom black generation curves. - **Hardware Instrument Support:** Direct integration with industry-standard spectrophotometers and colorimeters (X-Rite, Barbieri, Datacolor, Konica Minolta). - **Gamut Mapping & Verification:** Colorimetric, Perceptual, and Saturation rendering intents with CIECAM02 viewing condition modeling and rigorous $\Delta E$ round-trip verification. --- ## Multichannel & Expanded Gamut (ECG) Roadmap LithiumCMS is expanding beyond traditional 4-color boundaries to natively support high-fidelity 5, 6, and 7-color presses: | Device Space | Channels | Status | Description | | :--- | :---: | :---: | :--- | | **Gray** | 1 | **Stable** | Monochrome reflective / emissive devices | | **RGB / CMY** | 3 | **Stable** | Standard displays, scanners, and 3-component digital presses | | **CMYK** | 4 | **Stable** | Commercial 4-color offset and digital printing | | **5CLR** | 5 | **Implemented** | CMYK + 1 supplemental ink (e.g., Orange, White, or Red) | | **6CLR** | 6 | **Implemented** | Hexachrome, CMYK+OG, or CcMmYK (Light Cyan/Magenta) | | **7CLR** | 7 | **Implemented** | Expanded Color Gamut / Fogra55 standard (**CMYK + Orange + Green + Violet**) | > [!NOTE] > Detailed technical analysis, architectural bottlenecks, and mathematical solutions for 7-color reverse inversion are documented in [**`MULTICHANNEL_EXPANSION_RESEARCH_AND_PLAN.md`**](MULTICHANNEL_EXPANSION_RESEARCH_AND_PLAN.md). --- ## Profiling Pipeline & CLI Utilities LithiumCMS provides a modular command-line toolchain covering every stage of characterization and profiling: ```mermaid flowchart LR A["targen
(Patch Generator)"] -->|test.ti1| B["printtarg
(PostScript/TIFF Layout)"] B -->|Print & Measure| C["chartread
(Spectrophotometer)"] C -->|test.ti3| D["colprof
(Profile Engine)"] D -->|profile.icc| E["xicclu / profcheck
(Gamut & Verification)"] ``` ### Core Utilities | Binary | Role | Description | | :--- | :--- | :--- | | `targen` | Target Generation | Generates scattered, multidimensional, or body-centered cubic test patches in device space. | | `printtarg` | Layout Engine | Converts `.ti1` patch lists into printable PostScript, EPS, TIFF, or PDF target charts. | | `chartread` | Measurement | Drives connected spectrophotometers (i1Pro, etc.) to capture spectral / CIELAB reflection data into `.ti3` files. | | `colprof` | Profile Generator | Reads measured `.ti3` data and compiles the forward and inverse CLUTs into an ICC device profile. | | `xicclu` | Profile Lookup | Evaluates profiles in forward or reverse directions for color conversions, ink values, and diagnostics. | | `profcheck` | Accuracy Verification | Computes average, maximum, and percentile $\Delta E$ report against characterization datasets. | ### Quick Start: Basic Printer Profile ```bash # 1. Generate an optimized CMYK test chart with 836 patches and 64 gray ramp steps bin/targen -v -d4 -f836 -g64 my_printer # 2. Format into a 300 DPI TIFF target ready to print without color management bin/printtarg -v -ii1 -pA4 -T300 my_printer # 3. Measure target with a spectrophotometer (e.g. i1Pro) to create my_printer.ti3 bin/chartread -v -y1 -N my_printer # 4. Generate the ICC profile with high quality and 280% total ink limit (TAC) bin/colprof -v -qm -t280 -D "Custom Press Profile" my_printer # 5. Inspect and verify profile accuracy bin/profcheck -v -k my_printer.ti3 my_printer.icc ``` --- ## Building from Source LithiumCMS uses Perforce Jam (`jam`) for multi-platform compilation. ### 1. Prerequisites #### Debian / Ubuntu / Mint ```bash sudo apt update sudo apt install build-essential ftjam libtiff-dev libjpeg-dev libpng-dev libusb-1.0-0-dev libx11-dev libxext-dev libxinerama-dev libxrandr-dev libxxf86vm-dev ``` #### Fedora / RHEL ```bash sudo dnf install gcc gcc-c++ jam libtiff-devel libjpeg-turbo-devel libpng-devel libusb1-devel libX11-devel libXext-devel libXinerama-devel libXrandr-devel ``` #### macOS (Homebrew) ```bash brew install jam libtiff libpng jpeg-turbo libusb ``` --- ### 2. Native Compilation From the repository root: ```bash cd Argyll_V3.5.0 jam -q ``` Upon completion, all compiled executables are placed in `Argyll_V3.5.0/bin/`. To install system-wide (optional): ```bash sudo ./makeinstall.sh ``` --- ### 3. Containerized Build (Docker) For a clean, reproducible build environment without modifying host packages: ```dockerfile # Save as Dockerfile.build FROM ubuntu:24.04 RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential ftjam libtiff-dev libjpeg-dev libpng-dev \ libusb-1.0-0-dev libx11-dev libxext-dev libxinerama-dev \ libxrandr-dev libxxf86vm-dev ca-certificates git \ && rm -rf /var/lib/apt/lists/* WORKDIR /build COPY . . WORKDIR /build/Argyll_V3.5.0 RUN jam -q CMD ["/bin/bash"] ``` Build and run: ```bash docker build -t lithium-cms:latest -f Dockerfile.build . docker run --rm -it -v $(pwd):/workspace lithium-cms:latest ``` --- ## Codebase Organization ```text LithiumCMS/ ├── README.md # Project documentation ├── MULTICHANNEL_EXPANSION_RESEARCH_AND_PLAN.md # Multichannel architecture and implementation blueprint └── Argyll_V3.5.0/ # Core engine source tree ├── Jamfile, Jamtop # Perforce Jam build scripts ├── icc/ # Core ICC profile parser and tag structures (icclib) ├── rspl/ # Regular Simplex Spline forward and inverse engine ├── profile/ # Profile generation logic (colprof, profout, profin) ├── xicc/ # Extended color transformations, colorants, inking ├── gamut/ # 3D surface description and gamut mapping ├── target/ # Test chart patch generators (targen, printtarg) ├── cgats/ # CGATS / IT8 text measurement file parser (.ti1, .ti3) ├── spectro/ # Hardware spectrophotometer communication drivers └── numlib/ # Numerical analysis, matrix math, non-linear optimizers ``` --- ## Technical Documentation & References - [Multichannel Research & Technical Blueprint](MULTICHANNEL_EXPANSION_RESEARCH_AND_PLAN.md): In-depth architectural analysis of the forward and reverse CLUT bottlenecks, simplicial inversion limits, and the Hue-Sector decomposition algorithm for 7-color presses. - [ICC.1 Specification (ICC v4)](https://www.color.org/icc_specs2.xalter): International Color Consortium Profile Format. - [FOGRA55 Characterization Data](https://fogra.org/en/downloads/work-tools/fogra55-ecg): Standard exchange dataset for 7-color Expanded Color Gamut (CMYKOGV) printing. --- ## Licensing & Acknowledgments - **License:** LithiumCMS is published under the **GNU Affero General Public License Version 3 (AGPLv3)**. See [License.txt](Argyll_V3.5.0/License.txt) for details. - **Attribution:** LithiumCMS builds upon the foundational architecture, mathematical modeling, and device driver implementations of **ArgyllCMS**, originally authored and maintained by **Graeme W. Gill**.