BlurHash encoder implementation for Python
Project description
blurhash-python
This is an encoder for the BlurHash algorithm. To find out more about BlurHash, see https://github.com/woltapp/blurhash.
Installation
Install blurhash with pip
$ pip install blurhash-python
or pipenv
$ pipenv install blurhash-python
Usage
Create blurhash from image file
import blurhash
with open('image.jpg', 'rb') as image_file:
hash = blurhash.encode(image_file, x_components=4, y_components=3)
Alternatively, scale the image to produce a faster hash, and create a blurhash from the in-memory image directly
import blurhash
from PIL import Image
with Image.open('image.jpg') as image:
image.thumbnail(( 100, 100 ))
hash = blurhash.encode(image, x_components=4, y_components=3)
You can also pass file name as parameter to the function
import blurhash
hash = blurhash.encode('image.jpg', x_components=4, y_components=3)
y_components and x_components parameters adjust the amount of
vertical and horizontal AC components in hashed image. Both parameters must
be >= 1 and <= 9.
Development
Install development requirements and package in editable mode
$ pipenv install --dev
Tests
Run test suite with pytest in virtual environment
$ pytest
Use tox to run test suite against all supported python versions
$ tox
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blurhash-python-1.2.2.tar.gz.
File metadata
- Download URL: blurhash-python-1.2.2.tar.gz
- Upload date:
- Size: 178.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2dbb8a58c5a299c8fca81112e52471a15cff38020ca9a65dae96a777609b8d4
|
|
| MD5 |
b89d577ec546da29a50627819032ece7
|
|
| BLAKE2b-256 |
77a39a94cb58332bf0ca76176389f818f37521515ce82acd7d7fed5d15e27150
|
File details
Details for the file blurhash_python-1.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 33.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c05fc979cec17f10f903c0787398f5c26d970aaac39beeebcdd0480930b583c6
|
|
| MD5 |
b0ccc17a7833a60a03eb81ab4b1342cf
|
|
| BLAKE2b-256 |
c15d4b6fb56cd800c7dd57af7a976fdeafc48643410436e3713eb6241f755413
|
File details
Details for the file blurhash_python-1.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 34.3 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a494c3f0d6935a329b14c153082ecdea4040a6810b003cd4fff908b3e5654acd
|
|
| MD5 |
5e3d5134f464bd662be799fb4aa8f3f7
|
|
| BLAKE2b-256 |
3e73893abe41048533637431489780115dd5ac0c7a38372b08840bd88c010967
|
File details
Details for the file blurhash_python-1.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 33.3 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
825eaa6c83595e239b533ab8f7919b20469e6bf5e3d41d6e424e671db45a06f5
|
|
| MD5 |
d28491230169540215f938bb80a666ed
|
|
| BLAKE2b-256 |
3a13ad2d144f7d5d8668ac01f25c32fa0f188b2f939b4cf271f86d6f3fc77d50
|
File details
Details for the file blurhash_python-1.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 34.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d704e3b0f206c6aab5fb64ddcfddcaa3a1b964f2d6c5a6a6702452ae055ea41
|
|
| MD5 |
c08be568cbb84c27ad5e1c9d71bf9a39
|
|
| BLAKE2b-256 |
b90bd45bda75c7702a84d1230f6280b353255c2e8ddb88ecce2c8badaf40a482
|
File details
Details for the file blurhash_python-1.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 33.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37675ff297e9698068d3537401a2ce4716a7ef03428cdaf0ea5a73c07a48a81
|
|
| MD5 |
b4482c990fb8fefd146ae8336119480c
|
|
| BLAKE2b-256 |
7fa6daaba4e59f1e9e4f1fc8daa92be9b3ded23b46b7e8f07f2871ea952c8f4b
|
File details
Details for the file blurhash_python-1.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 34.2 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01f933a2ac5e25c79aedcd8dc01195c7abf4f1ae412da186a15e5f04baaccdc5
|
|
| MD5 |
0ef38669acfcc17ab0e41c1fe0e1a98e
|
|
| BLAKE2b-256 |
b525f6ce3eee40352af7571c230a69cdfdd48e9b92a10df78f2245cb7a620959
|
File details
Details for the file blurhash_python-1.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 33.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfe467fcb1d32dcc5a17feb1f55e5cee3c293a1f2c6141f7329926eab5fc6fe4
|
|
| MD5 |
3139815317b7f2826c1989830a7937a6
|
|
| BLAKE2b-256 |
1a626d71cd4dfa050f3f1de003a04e596783d28e9a262335a7561d6684a87ae8
|
File details
Details for the file blurhash_python-1.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 34.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc983cf7d42e033e0326f06da2d470947916103c8d4362d6a87ef522db368524
|
|
| MD5 |
a9fe626c01e86ccd96408a673c461693
|
|
| BLAKE2b-256 |
9160ff01b3778880faa58ee03e6d4ce66c668c451c62cb3d51b214826f3d4df6
|
File details
Details for the file blurhash_python-1.2.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 33.4 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be8ccbc972e8b9d9fcb2c23b871e1106c4fdb4bcacd2643174e6cad4128184a2
|
|
| MD5 |
89c4422b75639260eb38b609b08e8288
|
|
| BLAKE2b-256 |
7cb1beab534e319aad7df3abf2aeef6bf3c5b64d71be0c44ca0ab692e1aaf0f3
|
File details
Details for the file blurhash_python-1.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: blurhash_python-1.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 34.4 kB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6c857df119dcd03fb0371954e809ad57dfe1846ca4eb8bc7b732a73ae19d42c
|
|
| MD5 |
b6308a0f8a21476af84e170b0ead4551
|
|
| BLAKE2b-256 |
693336ec3a9d158df48686291d03213a91c3fa7524a861903a0b356244671327
|