Skip to content

Repository files navigation

cmm: Color Management Module based on lcms2. Not a full wrapper.

Color management is a kind of rocket science. You should be a specialist of ICC color management before struggling this module. You should be familiar with soft proofing, color conversion intent, gamut, etc. first. These are the ABC of color management. Please don't try to learn such deep knowledge from this module and document.

I don't want to repeat lcms2 document here. This module is a thin wrapper of lcms2. Not a full wrapper, but covers most common usage.

How to use

See tests/test_from_python.py. Advanced usage (partial profile and LUT) is not shown there. If you are informed enough to use it, you don't need any instruction.

import faulthandler; faulthandler.enable() is strongly recommended. There is no memory protection in this module. You can easily make a segmentation fault.

To integrade to your product, pip install cmm-16bit. Be careful of -16bit. Just cmm is not mine. If you do not need 16-bit per chanel, consider ImageCms module of Pillow.

Versioning

It is the default versioning scheme of setuptools-scm. Commit and tag with a version number when you need clean version.

Build

Requires cmake. VS2022 for Windows, Homebrew for macOS, sudo apt install python3.11-dev for Ubuntu, etc.

Retrieve all submodules by git submodule update --init.

python -m pip install -U pip build
python -m build --wheel

For macOS, MACOSX_DEPLOYMENT_TARGET=11 python -m build --wheel is preferable.

For Pyodide, with some Linux:

pip install pyodide-build
pyodide build .

The generated whl file should be found in dist directory. The wheel name is cmm_16bit.

Unit testing

Build with python -m build --wheel. Do not forget --wheel. It generates build directory and tests/test_from_python.py uses the output.

pip install numpy pillow

python -m unittest ./tests/test_from_python.py

For Pyodide, you should install the cmm-16bit wheel too.

Pyodide fails transform test (test_8_8, test_8_8_proofing and test_patch) because it makes a bit different result. So I skipped them.

About revert patch for Little-CMS commit bb60a46

My ICC profile (sublinova-epson4pigment-PBT-20231121_srgb.icc) is broken by Little-CMS commit bb60a46. I think that the commit is wrong.

License

MIT License.

About

A Python library for color management based on lcms2.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages