A very compact representation of an image placeholder
Project description
thumbhash-py
A Python port of the thumbhash encoder by Evan Wallace
Installation
Install thumbhash with pip
pip install thumbhash
Optionally install with pillow support:
pip install thumbhash[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, ...]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
thumbhash_py-0.1.0.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for thumbhash_py-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aff1695100dba72e3cf73fa86862ccbe12c95167562773d8c04d11ab937154c |
|
MD5 | 548e16eac11fcaa55c2c355dfb71192b |
|
BLAKE2b-256 | 7ebc978ffda900ba2e8be853b2516b546eeb6f729c6d2d0bf8bfec24a3f7dfce |