Skip to main content

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 just recipe (needs the Rust toolchain):

just python-cbuild   # stages chromahash/_uniffi.py + the native lib

just build-python and just 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for chromahash 0.7.1
File
chromahash-0.7.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
chromahash-0.7.1-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
chromahash-0.7.1-py3-none-manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
chromahash-0.7.1-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details
chromahash-0.7.1-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.1-py3-none-win_amd64.whl

Download URL chromahash-0.7.1-py3-none-win_amd64.whl
Size 232.0 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ae574ff935420d1969779059ce4beab3ef129f722872446176385331861f2e5c
BLAKE2b-256 checksum
How to use checksums
2181c674b517d4b42746db3105601d8c4e69320b59d983b87c733163ba510007
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 Aug 29, 2026.

Transparency log

Release files / chromahash-0.7.1-py3-none-manylinux2014_x86_64.whl

Download URL chromahash-0.7.1-py3-none-manylinux2014_x86_64.whl
Size 347.6 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
08eb375c2861efdc5123f78e9b8bcbb5d388e00885891894127f89bbfe953711
BLAKE2b-256 checksum
How to use checksums
dccba260f0f52a7edabb60ad3f18c5551cbf71d1c2b07137b1413354eb598bf9
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 Aug 29, 2026.

Transparency log

Release files / chromahash-0.7.1-py3-none-manylinux2014_aarch64.whl

Download URL chromahash-0.7.1-py3-none-manylinux2014_aarch64.whl
Size 329.2 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
7fc2d2bc257c80ff390dab9d49d0427a0c891858ff00a30f3ef91cb731dfae6f
BLAKE2b-256 checksum
How to use checksums
35813f691ed2c961f22c7644f388328f67646ab589ad29840900c494881413cc
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 Aug 29, 2026.

Transparency log

Release files / chromahash-0.7.1-py3-none-macosx_11_0_x86_64.whl

Download URL chromahash-0.7.1-py3-none-macosx_11_0_x86_64.whl
Size 336.4 kB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
a18de8335deaf992fb140cb9afc90ed72564ae81aa27f108619f94b75735ffa2
BLAKE2b-256 checksum
How to use checksums
0612dc3ed59e4d7375d763a41bfad393b005828f6b8fe3fb5de6ed72167e31f5
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 Aug 29, 2026.

Transparency log

Release files / chromahash-0.7.1-py3-none-macosx_11_0_arm64.whl

Download URL chromahash-0.7.1-py3-none-macosx_11_0_arm64.whl
Size 320.6 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
42cce9317af92872a91b222fdd759f74dec79fb9fa3b1b78767f943b1dff1a0c
BLAKE2b-256 checksum
How to use checksums
1948b97b7c5941663e8dc205c4f1fb9149a9ec305b23513a8f973907fe322468
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 Aug 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.2

5 release files

This release

0.7.1 This release

5 release files

0.6.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page