Skip to main content

ChromaHash: modern LQIP (Low Quality Image Placeholder) format

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

chromahash-0.6.0-py3-none-win_amd64.whl (196.5 kB view details)

Uploaded Python 3Windows x86-64

chromahash-0.6.0-py3-none-manylinux2014_x86_64.whl (311.6 kB view details)

Uploaded Python 3

chromahash-0.6.0-py3-none-manylinux2014_aarch64.whl (298.0 kB view details)

Uploaded Python 3

chromahash-0.6.0-py3-none-macosx_11_0_x86_64.whl (303.2 kB view details)

Uploaded Python 3macOS 11.0+ x86-64

chromahash-0.6.0-py3-none-macosx_11_0_arm64.whl (291.7 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file chromahash-0.6.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: chromahash-0.6.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 196.5 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chromahash-0.6.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bf1745c6c8718ae5b18e80912b729973f46afd96d143c4391d230055a1a41c2b
MD5 023986acf1d95afa4c762d27497df5d6
BLAKE2b-256 21d722184001e32ccf2b42b1fcb126441369fa63148c2fe3c79e21a7989e97a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for chromahash-0.6.0-py3-none-win_amd64.whl:

Publisher: release-pypi.yml on justin13888/chromahash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chromahash-0.6.0-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chromahash-0.6.0-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e4b6b0c4f036a3bb46ebf2fffea4f6d2bd31aceb6e4be4b832367e3d5940031
MD5 07c0da43c48d3e89f38272e124e4dce6
BLAKE2b-256 3fbabf1a40f17bb33152c08b11dbbc77d775c6016984ea7554d7165d135ce0db

See more details on using hashes here.

Provenance

The following attestation bundles were made for chromahash-0.6.0-py3-none-manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on justin13888/chromahash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chromahash-0.6.0-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for chromahash-0.6.0-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 18d38013c0dc4346c3b5964c1e3b887ca35177d10759567f8ceceaccfb60b528
MD5 ba4ae76f682b15901fbfa234f7070cb4
BLAKE2b-256 6bff54004cc551bde4649ca9bc6d25b8803266659a1ac75c345709c6d9de04e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for chromahash-0.6.0-py3-none-manylinux2014_aarch64.whl:

Publisher: release-pypi.yml on justin13888/chromahash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chromahash-0.6.0-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for chromahash-0.6.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f27567f43105afb1da8ab51038ee73e723ffefa892f1f81f1560cc5ee18c420b
MD5 49e4bdf4326a532967eb87714dbb764f
BLAKE2b-256 6a692e77b98e4890b4a855494510efed87798c41deff24056fe23206648707c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for chromahash-0.6.0-py3-none-macosx_11_0_x86_64.whl:

Publisher: release-pypi.yml on justin13888/chromahash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chromahash-0.6.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromahash-0.6.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1287ef1e44002233df43961e4c5a021a1054ce28518256e157e52803b1f7dbb9
MD5 a64c0c340c4256f5ff50ea2610136871
BLAKE2b-256 53116bd3e2aaf2cc0e4543be300ccb998975d0e5e92c9911eb0ac9c92d466c93

See more details on using hashes here.

Provenance

The following attestation bundles were made for chromahash-0.6.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on justin13888/chromahash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page