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', 'r') as image_file:
    hash = blurhash.encode(image_file, 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.0.1.tar.gz (179.6 kB view hashes)

Uploaded Source

Built Distributions

blurhash_python-1.0.1-cp38-cp38-manylinux2010_x86_64.whl (21.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

blurhash_python-1.0.1-cp38-cp38-manylinux1_x86_64.whl (21.5 kB view hashes)

Uploaded CPython 3.8

blurhash_python-1.0.1-cp38-cp38-manylinux1_i686.whl (16.1 kB view hashes)

Uploaded CPython 3.8

blurhash_python-1.0.1-cp37-cp37m-manylinux2010_x86_64.whl (21.1 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

blurhash_python-1.0.1-cp37-cp37m-manylinux1_x86_64.whl (21.0 kB view hashes)

Uploaded CPython 3.7m

blurhash_python-1.0.1-cp37-cp37m-manylinux1_i686.whl (15.8 kB view hashes)

Uploaded CPython 3.7m

blurhash_python-1.0.1-cp36-cp36m-manylinux2010_x86_64.whl (21.1 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

blurhash_python-1.0.1-cp36-cp36m-manylinux1_x86_64.whl (21.1 kB view hashes)

Uploaded CPython 3.6m

blurhash_python-1.0.1-cp36-cp36m-manylinux1_i686.whl (15.8 kB view hashes)

Uploaded CPython 3.6m

blurhash_python-1.0.1-cp35-cp35m-manylinux2010_x86_64.whl (21.5 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

blurhash_python-1.0.1-cp35-cp35m-manylinux1_x86_64.whl (21.5 kB view hashes)

Uploaded CPython 3.5m

blurhash_python-1.0.1-cp35-cp35m-manylinux1_i686.whl (15.8 kB view hashes)

Uploaded CPython 3.5m

blurhash_python-1.0.1-cp27-cp27mu-manylinux2010_x86_64.whl (25.3 kB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

blurhash_python-1.0.1-cp27-cp27mu-manylinux1_x86_64.whl (25.3 kB view hashes)

Uploaded CPython 2.7mu

blurhash_python-1.0.1-cp27-cp27mu-manylinux1_i686.whl (18.9 kB view hashes)

Uploaded CPython 2.7mu

blurhash_python-1.0.1-cp27-cp27m-manylinux2010_x86_64.whl (25.3 kB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

blurhash_python-1.0.1-cp27-cp27m-manylinux1_x86_64.whl (25.3 kB view hashes)

Uploaded CPython 2.7m

blurhash_python-1.0.1-cp27-cp27m-manylinux1_i686.whl (18.9 kB view hashes)

Uploaded CPython 2.7m

Supported by

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