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.

Files for blurhash-python, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size blurhash_python-1.0.0-cp27-cp27m-manylinux1_i686.whl (18.9 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp27-cp27m-manylinux1_x86_64.whl (25.2 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp27-cp27m-manylinux2010_x86_64.whl (25.2 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp27-cp27mu-manylinux1_i686.whl (18.9 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp27-cp27mu-manylinux1_x86_64.whl (25.2 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp27-cp27mu-manylinux2010_x86_64.whl (25.3 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp35-cp35m-manylinux1_i686.whl (15.8 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp35-cp35m-manylinux1_x86_64.whl (21.5 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp35-cp35m-manylinux2010_x86_64.whl (21.5 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp36-cp36m-manylinux1_i686.whl (15.8 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp36-cp36m-manylinux1_x86_64.whl (21.1 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp36-cp36m-manylinux2010_x86_64.whl (21.1 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp37-cp37m-manylinux1_i686.whl (15.8 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp37-cp37m-manylinux1_x86_64.whl (21.0 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size blurhash_python-1.0.0-cp37-cp37m-manylinux2010_x86_64.whl (21.1 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size blurhash-python-1.0.0.tar.gz (179.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page