Metadata-Version: 2.4
Name: thumbhash-py
Version: 0.1.2
Summary: A very compact representation of an image placeholder
Project-URL: Documentation, https://github.com/justinforlenza/thumbhash-py#readme
Project-URL: Issues, https://github.com/justinforlenza/thumbhash-py/issues
Project-URL: Source, https://github.com/justinforlenza/thumbhash-py
Author-email: Justin <justin@forlenza.co>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7
Provides-Extra: pillow
Requires-Dist: pillow; extra == 'pillow'
Description-Content-Type: text/markdown

<img src="https://img.shields.io/pypi/v/thumbhash-py"> <img src="https://img.shields.io/github/license/justinforlenza/thumbhash-py">

# thumbhash-py
A Python port of the [thumbhash](https://github.com/evanw/thumbhash) encoder by [Evan Wallace](https://github.com/evanw)

## Installation
Install thumbhash with pip
```sh
pip install thumbhash-py
```
Optionally install with pillow support:
```sh
pip install thumbhash-py[pillow]
```

## Usage
Encode a RGBA array to a ThumbHash
```py
from thumbhash import rgba_to_thumb_hash


rgba = [100, 85, 15, 255, 100, 84, 32, 255,...]
width = 100
height = 75

thumb_hash = rgba_to_thumb_hash(rgba, width, height) # [86, 8, 10, 13, 128, 22, 234, 86, 111, 117, ...]
```
Open an image using pillow, scale down to max dimensions of 100x100 and encode to a ThumbHash
```py
from thumbhash import image_to_thumb_hash

thumb_hash = image_to_thumb_hash('image.jpg') # [86, 8, 10, 13, 128, 22, 234, 86, 111, 117, ...]
```

## Features
As of now this library only handles the conversion of images to hashes, not the reverse.
