Image Quantizer
Simple Python package to convert an image into a quantized image using a customizable palette. Resulting image can be displayed by ePaper displays such as Waveshare displays.
Installation
It can be installed as a PyPi package
pip install --user image-quantizer
It can also be installed manually
git clone https://github.com/lobis/image-quantizer
cd image-quantizer
python3 setup.py install --user
Usage
from image_quantizer import quantize_image
with Image.open("tests/data/cliff.jpg") as image:
quantized_image = quantize_image(image, palette=PALETTES["WAVESHARE-EPD-7COLOR"])
quantized_image.save("cliffs-quantized.png")
Custom palette
from image_quantizer import quantize_image, PALETTES
# Existing palette names
print(PALETTES)
palette = [
[0, 0, 0], # white
[255, 255, 255], # black
[0, 0, 255], # blue
[0, 255, 0], # green
]
with Image.open("tests/data/cliff.jpg") as image:
quantized_image_custom = quantize_image(image, palette=palette)
quantized_image_custom.show()
Split by Palette
In some cases such as highlighted here, it might be useful to split an image into its colors. This is necessary to display the image in a waveshare RED-WHITE-BLACK display.
from image_quantizer import quantize_image, split_image_by_color
with Image.open("tests/data/cliff.jpg") as image:
quantized_image = quantize_image(image, palette=PALETTES["BLACK-WHITE-RED"])
split_images = split_image_by_color(image)
for color, image in split_images:
image.show()
Original image:
Single palette color images:
Metadata
Release files for image-quantizer 0.0.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 | Provenance | Actions |
|---|---|---|---|---|
| image-quantizer-0.0.2.tar.gz | 5.0 kB | Without provenance | Details for image-quantizer-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| image_quantizer-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for image_quantizer-0.0.2-py3-none-any.whl |
Total release size: 11.1 kB
Release files / image-quantizer-0.0.2.tar.gz
| Download URL | image-quantizer-0.0.2.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eea36e1f07b0463f0031e438d2bf90e0574a33425dc4d3740fa604892364212e
|
|
BLAKE2b-256 checksum How to use checksums |
e9b759e0d35ff75493a7b73911f0914f10195e37d7a9e3c536c3c11e975822b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / image_quantizer-0.0.2-py3-none-any.whl
| Download URL | image_quantizer-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8fb0cf1363f089eb335751ccd5ffe7a0c2df234ee25825157b031007b831308
|
|
BLAKE2b-256 checksum How to use checksums |
31c58e66874cf50f64fa08f90c9fb36f3f3cd42a9eae371cea7b2061f81aef7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Security for image-quantizer 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.