chromahash (Python)
Modern, high-quality image placeholder representation for professional formats (LQIP)
chromahash encodes an image into a compact, fixed 32-byte Low Quality Image
Placeholder (LQIP) and decodes it back into a low-fidelity preview. Color is
encoded in the perceptually-uniform OKLAB
space with wide-gamut input support (sRGB, Display P3, Adobe RGB, BT.2020,
ProPhoto RGB) and decodes to a caller-chosen display gamut (sRGB, Display P3,
or Adobe RGB).
This is the Python binding — a thin facade over UniFFI-generated ctypes
bindings to the Rust core. It carries no native algorithm of its own and produces
output bit-identical to every other ChromaHash implementation, validated
against the shared spec/ test vectors. It has zero external runtime
dependencies (ctypes is part of the standard library).
pip install chromahash
Usage
from chromahash import ChromaHash, Gamut
# width × height × 4 bytes (RGBA) — a 2×2 image here.
rgba = bytes([
255, 0, 0, 255, 0, 255, 0, 255,
0, 0, 255, 255, 255, 255, 0, 255,
])
ch = ChromaHash.encode(2, 2, rgba, Gamut.SRGB)
print(ch.as_bytes().hex()) # 32 bytes
# Reconstruct a preview. decode() targets sRGB; pass Gamut.DISPLAY_P3 or
# Gamut.ADOBE_RGB to render wide-gamut color.
width, height, pixels = ChromaHash.from_bytes(ch.as_bytes()).decode()
print(width, height, len(pixels))
Building from source
The native library and the generated bindings module are build outputs, staged by the mise task (needs the Rust toolchain):
mise run cbuild:python # stages chromahash/_uniffi.py + the native lib
mise run build:python and mise run test:python run this step automatically.
See the project repository for the full format specification and the other language implementations.
Note: ChromaHash is a pre-1.0 Draft format — the bitstream is not yet guaranteed stable across versions.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Release files for chromahash 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| chromahash-0.7.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| chromahash-0.7.2-py3-none-manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| chromahash-0.7.2-py3-none-manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| chromahash-0.7.2-py3-none-macosx_11_0_x86_64.whl | Python 3 | none | macOS 11.0+ x86-64 | Details |
| chromahash-0.7.2-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
Total release size:1.6 MB
Release files / chromahash-0.7.2-py3-none-win_amd64.whl
| Download URL | chromahash-0.7.2-py3-none-win_amd64.whl |
|---|---|
| Size | 235.0 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6e325296943d9260cc7252dde0f976a02d5c0d67013631a9387426540df4babb
|
|
BLAKE2b-256 checksum How to use checksums |
c424f31fba2c922c9c6353ae6eecaeb8966f884bf8a390d26f9ca71a3e069e26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / chromahash-0.7.2-py3-none-manylinux2014_x86_64.whl
| Download URL | chromahash-0.7.2-py3-none-manylinux2014_x86_64.whl |
|---|---|
| Size | 351.0 kB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
166cbbd68676e53d7c6b7cd1a5705b1fa3a0fe3750bdcf8c9b8a156c857bbe30
|
|
BLAKE2b-256 checksum How to use checksums |
ac869e38a7784caff519a258318bc3a38887ba218ccf78636a5d4320832fb1e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / chromahash-0.7.2-py3-none-manylinux2014_aarch64.whl
| Download URL | chromahash-0.7.2-py3-none-manylinux2014_aarch64.whl |
|---|---|
| Size | 331.3 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
66c26fc86135fcaf275b3fb2a373234de95e83625efc719dda5865e1fa6464e2
|
|
BLAKE2b-256 checksum How to use checksums |
e264291792e0452ceefd0e0c3a701172295349e056ca3e6253e62307c0209105
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / chromahash-0.7.2-py3-none-macosx_11_0_x86_64.whl
| Download URL | chromahash-0.7.2-py3-none-macosx_11_0_x86_64.whl |
|---|---|
| Size | 339.5 kB |
| Tags | Python 3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
fd32c4b9e1bc34742f86148edce14e80e19e88abe2ac8f5f047cc5b3db744b41
|
|
BLAKE2b-256 checksum How to use checksums |
e4fd756f056cf26765e3c1d62e8affcde7b5ce9188bf970f2d89efe0fdefd81e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / chromahash-0.7.2-py3-none-macosx_11_0_arm64.whl
| Download URL | chromahash-0.7.2-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 325.2 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e3a4093d228762fae1b7942be4ddd38a05ac8a7a9e33b1ba80623cfb41d4667a
|
|
BLAKE2b-256 checksum How to use checksums |
c4df10135648b77e2fb9cd944e16a4e464c2138fa351c0c91df1f932061156f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log