Calculate and visualize CIELab colour gamuts of displays
Project description
cielab-gamut-tools
Calculate and visualize CIELab colour gamuts of displays.
This is a Python port of the gamut-volume-m MATLAB library.
Features
- Load gamut data from CGATS.17 ASCII files or RGB/XYZ matrices
- Support for emissive and reflective displays (IDMS v1.3 format)
- Calculate gamut volumes via cylindrical integration in CIELab space
- Compute gamut intersections for coverage analysis
- Generate synthetic reference gamuts (sRGB, BT.2020, DCI-P3, etc.)
- Visualize gamuts as 3D surfaces or 2D rings
Installation
pip install cielab-gamut-tools
Or install from source:
git clone https://github.com/CIELab-gamut-tools/cielab-gamut-tools-py.git
cd cielab-gamut-tools-py
pip install -e .
Quick Start
from cielab_gamut_tools import Gamut, SyntheticGamut
# Load measured display gamut from CGATS file
display = Gamut.from_cgats("measurements.txt")
# Create standard reference gamuts
srgb = SyntheticGamut.srgb()
bt2020 = SyntheticGamut.bt2020()
# Calculate volumes
print(f"Display volume: {display.volume():.0f}")
print(f"sRGB volume: {srgb.volume():.0f}")
# Calculate sRGB coverage
intersection = display.intersect(srgb)
coverage = intersection.volume() / srgb.volume() * 100
print(f"sRGB coverage: {coverage:.1f}%")
# Visualize
display.plot_rings(reference=srgb)
Reference Gamuts
The library includes built-in reference gamuts:
srgb = SyntheticGamut.srgb() # sRGB (D65, gamma 2.2)
bt2020 = SyntheticGamut.bt2020() # BT.2020 (D65, gamma 2.4)
dci_p3 = SyntheticGamut.dci_p3() # DCI-P3 (DCI white, gamma 2.6)
display_p3 = SyntheticGamut.display_p3() # Display P3 (D65, gamma 2.2)
Or create custom gamuts:
custom = SyntheticGamut(
primaries_xy=[[0.68, 0.32], [0.265, 0.69], [0.15, 0.06]],
white_xy=[0.3127, 0.329],
gamma=2.2
)
Development
# Clone and install with dev dependencies
git clone https://github.com/CIELab-gamut-tools/cielab-gamut-tools-py.git
cd cielab-gamut-tools-py
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=cielab_gamut_tools --cov-report=term-missing
# Type checking
mypy src
# Linting
ruff check src tests
Citation
If you use this software in academic work, please cite:
Smith, E., et al. (2020). "Gamut volume calculation for display color characterization." Journal of the Society for Information Display.
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cielab_gamut_tools-0.1.0.tar.gz.
File metadata
- Download URL: cielab_gamut_tools-0.1.0.tar.gz
- Upload date:
- Size: 84.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48e3a4e5d2f16a9e0440612002f00aa847e20a8d9a77cc8d57caead6835d0af4
|
|
| MD5 |
7c1f4741ef009a7e8b13f8371207dcef
|
|
| BLAKE2b-256 |
15ea3848ffeccd08c35ec80b7b7eec3cf0ebee15a65f11575a39f83a71d2ebca
|
File details
Details for the file cielab_gamut_tools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cielab_gamut_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef2e639c444b01afbece1a6efd3a0571b24765f94063eb716229446714dd758
|
|
| MD5 |
b4e0400bffb30f867bea6f491c8a5b08
|
|
| BLAKE2b-256 |
19240863168c5e9ef9d359e2e46403c89a4c8ca17799182c140450846b80ecd7
|