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
Metadata
Release files for blurhash-python 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blurhash-python-1.2.2.tar.gz | 178.3 kB | Details |
Built distributions (wheels)
Total release size: 516.2 kB
Release files / blurhash-python-1.2.2.tar.gz
| Download URL | blurhash-python-1.2.2.tar.gz |
|---|---|
| Size | 178.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2dbb8a58c5a299c8fca81112e52471a15cff38020ca9a65dae96a777609b8d4
|
|
BLAKE2b-256 checksum How to use checksums |
77a39a94cb58332bf0ca76176389f818f37521515ce82acd7d7fed5d15e27150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
| Download URL | blurhash_python-1.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 33.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
c05fc979cec17f10f903c0787398f5c26d970aaac39beeebcdd0480930b583c6
|
|
BLAKE2b-256 checksum How to use checksums |
c15d4b6fb56cd800c7dd57af7a976fdeafc48643410436e3713eb6241f755413
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
| Download URL | blurhash_python-1.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 34.3 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
a494c3f0d6935a329b14c153082ecdea4040a6810b003cd4fff908b3e5654acd
|
|
BLAKE2b-256 checksum How to use checksums |
3e73893abe41048533637431489780115dd5ac0c7a38372b08840bd88c010967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
| Download URL | blurhash_python-1.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 33.3 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
825eaa6c83595e239b533ab8f7919b20469e6bf5e3d41d6e424e671db45a06f5
|
|
BLAKE2b-256 checksum How to use checksums |
3a13ad2d144f7d5d8668ac01f25c32fa0f188b2f939b4cf271f86d6f3fc77d50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
| Download URL | blurhash_python-1.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 34.2 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
0d704e3b0f206c6aab5fb64ddcfddcaa3a1b964f2d6c5a6a6702452ae055ea41
|
|
BLAKE2b-256 checksum How to use checksums |
b90bd45bda75c7702a84d1230f6280b353255c2e8ddb88ecce2c8badaf40a482
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
| Download URL | blurhash_python-1.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 33.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
a37675ff297e9698068d3537401a2ce4716a7ef03428cdaf0ea5a73c07a48a81
|
|
BLAKE2b-256 checksum How to use checksums |
7fa6daaba4e59f1e9e4f1fc8daa92be9b3ded23b46b7e8f07f2871ea952c8f4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
| Download URL | blurhash_python-1.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 34.2 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
01f933a2ac5e25c79aedcd8dc01195c7abf4f1ae412da186a15e5f04baaccdc5
|
|
BLAKE2b-256 checksum How to use checksums |
b525f6ce3eee40352af7571c230a69cdfdd48e9b92a10df78f2245cb7a620959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
| Download URL | blurhash_python-1.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 33.2 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
cfe467fcb1d32dcc5a17feb1f55e5cee3c293a1f2c6141f7329926eab5fc6fe4
|
|
BLAKE2b-256 checksum How to use checksums |
1a626d71cd4dfa050f3f1de003a04e596783d28e9a262335a7561d6684a87ae8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
| Download URL | blurhash_python-1.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 34.2 kB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
dc983cf7d42e033e0326f06da2d470947916103c8d4362d6a87ef522db368524
|
|
BLAKE2b-256 checksum How to use checksums |
9160ff01b3778880faa58ee03e6d4ce66c668c451c62cb3d51b214826f3d4df6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
| Download URL | blurhash_python-1.2.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 33.4 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
be8ccbc972e8b9d9fcb2c23b871e1106c4fdb4bcacd2643174e6cad4128184a2
|
|
BLAKE2b-256 checksum How to use checksums |
7cb1beab534e319aad7df3abf2aeef6bf3c5b64d71be0c44ca0ab692e1aaf0f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / blurhash_python-1.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
| Download URL | blurhash_python-1.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 34.4 kB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
f6c857df119dcd03fb0371954e809ad57dfe1846ca4eb8bc7b732a73ae19d42c
|
|
BLAKE2b-256 checksum How to use checksums |
693336ec3a9d158df48686291d03213a91c3fa7524a861903a0b356244671327
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|