Skip to main content

thumbhash-py

A Python port of the thumbhash encoder by Evan Wallace

Installation

Install thumbhash with pip

pip install thumbhash-py

Optionally install with pillow support:

pip install thumbhash-py[pillow]

Usage

Encode a RGBA array to a ThumbHash

from thumbhash import rgba_to_thumb_hash


rgba = [100, 85, 15, 255, 100, 84, 32, 255,...]
width = 100
height = 75

thumb_hash = rgba_to_thumb_hash(rgba, width, height) # [86, 8, 10, 13, 128, 22, 234, 86, 111, 117, ...]

Open an image using pillow, scale down to max dimensions of 100x100 and encode to a ThumbHash

from thumbhash import image_to_thumb_hash

thumb_hash = image_to_thumb_hash('image.jpg') # [86, 8, 10, 13, 128, 22, 234, 86, 111, 117, ...]

Features

As of now this library only handles the conversion of images to hashes, not the reverse.

Metadata

Release files for thumbhash-py 0.1.2

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

Source distribution (sdist)

Source distribution for thumbhash-py 0.1.2
File Size Uploaded Provenance Actions
thumbhash_py-0.1.2.tar.gz 5.9 kB Without provenance Details for thumbhash_py-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for thumbhash-py 0.1.2
File Interpreter ABI Platform Actions
thumbhash_py-0.1.2-py3-none-any.whl Python 3 none any Details for thumbhash_py-0.1.2-py3-none-any.whl

Total release size: 10.3 kB

Release files / thumbhash_py-0.1.2.tar.gz

Download URL thumbhash_py-0.1.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9c1494d9a7c23de817118f99816b3ff05344af886bc430cd8684157b708c8a17
BLAKE2b-256 checksum
How to use checksums
b687b90bed9fc305e1656e2624234fdfa3dd3d1cdd2ab0978a94cff9cd0e2ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / thumbhash_py-0.1.2-py3-none-any.whl

Download URL thumbhash_py-0.1.2-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1805077fb0cd6a6ed4f435cff7297a5e8a21893ab6be5e759bec70107d1fc45a
BLAKE2b-256 checksum
How to use checksums
c6344beaa5aa3f56012282fd1f9153a269eaf0921c0e3843e12e845a6cacea52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Security for thumbhash-py 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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