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.

Release files for thumbhash 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 0.1.2
File Size Uploaded
thumbhash-0.1.2.tar.gz 13.8 kB Details

Built distribution (wheel)

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

Total release size: 18.9 kB

Release files / thumbhash-0.1.2.tar.gz

Download URL thumbhash-0.1.2.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ef4e6398f93f3b5ad480dc8e3a3b3a200813c86a8857fb069f8478be809f8247
BLAKE2b-256 checksum
How to use checksums
d117fc026b10f448e25413e4cc692c9ca00cc8ef0e4022a1dd8d7b90761c9be9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.3

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

Download URL thumbhash-0.1.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5dbddde2349c35c65d70af11637e9c89a97a2b5a134f3e14bcf2a5dd82522a22
BLAKE2b-256 checksum
How to use checksums
9a640b5d39612708e892ca67934a0d98b2a2b06aabe8261be800b5db54f9702e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.0.0

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