Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blurhash-python-1.2.0.tar.gz (178.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blurhash_python-1.2.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (33.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

blurhash_python-1.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (33.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

blurhash_python-1.2.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (33.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

blurhash_python-1.2.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (33.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

blurhash_python-1.2.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (33.5 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file blurhash-python-1.2.0.tar.gz.

File metadata

  • Download URL: blurhash-python-1.2.0.tar.gz
  • Upload date:
  • Size: 178.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for blurhash-python-1.2.0.tar.gz
Algorithm Hash digest
SHA256 4caf57039c386ef53fb17598cd90a5c3eca1c76f529c35b4d67166070b9d2de2
MD5 de01aa4ffdf50f5a4b41bb9fd216ef44
BLAKE2b-256 8029959ec595af9bbf6f12a7d8124cea94ae3dda5665436ed8357000ac5c24d4

See more details on using hashes here.

File details

Details for the file blurhash_python-1.2.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blurhash_python-1.2.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 82210d27e744a1aab3fac59f95f34b9df50aaf300cf132d72588588ce137c746
MD5 5e03ea18f75cf5b4e200e40efecc7231
BLAKE2b-256 8dcf6ab8160491342e4801141538b369472d849052709eab5f3deef7034475de

See more details on using hashes here.

File details

Details for the file blurhash_python-1.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blurhash_python-1.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ecbdd7c4f67787e23ce906940024e64cacc872a21a5e9eb60bcd94bfdb2c5c13
MD5 ef70a9ac7d82c6c510d461730308743e
BLAKE2b-256 936bde6f885e01b2dba51ea8dd7e3b8d6618b7433bfb920ac3e7d82e1af7e0ca

See more details on using hashes here.

File details

Details for the file blurhash_python-1.2.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blurhash_python-1.2.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c44df545af61fc8bb6a16723329a08a47f625278e17cfae6e81487c6d1903ffd
MD5 1e0630ddf211dda18a70f77cbfe463d2
BLAKE2b-256 0c24e59cb19f6e44cda9f87905ad20a6d9a2c6e7c70c7bfcbd5197e279a3d6de

See more details on using hashes here.

File details

Details for the file blurhash_python-1.2.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blurhash_python-1.2.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b154189c9eb34f72696d724ffd317c6d27f1f68d47e3752b88c3a89ccc44b13f
MD5 07f48191ece836c59683108179576aa1
BLAKE2b-256 d20adedc791335f0e5d914d0af6db9aca3376eb87e13fff501cb605e84462db9

See more details on using hashes here.

File details

Details for the file blurhash_python-1.2.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blurhash_python-1.2.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7631977ab489eb8d4338347e3d954aca80e2922f21a66c65b12cc1f4e130da71
MD5 93eed0befeb7b1c8491e24f628211fd1
BLAKE2b-256 dc0b3b8107235c6e4f552d5f06ad71ecf965ff42eed9f34e93397ffc334f8747

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page