Python libimagequant Integrations
This library provides helper functions for converting between objects in the unofficial Python libimagequant bindings library and "image" objects in various popular Python libraries.
If you'd like to add support for integration with more libraries, pull requests are welcome!
Install with pip:
python3 -m pip install libimagequant_integrations
API Documentation
This package contains the following submodules, for converting to/from the indicated classes:
libimagequant_integrations.PIL(for Pillow'sPIL.Image.Image*)libimagequant_integrations.PySide2(forPySide2.QtGui.QImage)libimagequant_integrations.PySide6(forPySide6.QtGui.QImage)libimagequant_integrations.PyQt5(forPyQt5.QtGui.QImage)libimagequant_integrations.PyQt6(forPyQt6.QtGui.QImage)libimagequant_integrations.skimage(for scikit-image numpy arrays†)libimagequant_integrations.png(for PyPNGpng.Readerandpng.Writer‡)
I suggest you import using (for example)
import libimagequant_integrations.PyQt5 as liq_PyQt5, to avoid typing an
excessive amount. :)
Each submodule contains two functions, used to convert to and from the
libimagequant.Image class:
to_liq(image: OtherImageClass, attr: libimagequant.Attr) -> libimagequant.Image
from_liq(result: libimagequant.Result, image: libimagequant.Image) -> OtherImageClass
(Replace OtherImageClass with the appropriate other image class.)
You can check libimagequant_integration's version number using
libimagequant_integrations.VERSION and
libimagequant_integrations.VERSION_STR, which are in the same format as the
version number constants in the libimagequant bindings library itself. The
version numbers follow semantic versioning. They begin with 1.0.0, and do not
track libimagequant's version numbers at all.
*
While Pillow claims to support images with RGBA palettes, this feature seems
extremely buggy, almost to the point of being completely unusable. Therefore,
the from_liq() function discards the alpha channel and returns an image with
a RGB palette. If you do need the alpha channel information, you can obtain it
manually from the libimagequant.Image object.
†
Give to_liq() an RGBA image (numpy array of shape (y, x, 4), with
uint8-type elements) as its "image" argument. from_liq() returns two numpy
arrays: one with pixel data (shape (y, x, 1), uint8-type elements), and one
with the RGBA color palette (shape (n, 4), uint8-type elements).
‡
Give to_liq() a png.Reader as its "image" argument. from_liq() returns a
png.Writer and a bytes object; you can save the image using the Writer's
write_array() method with the bytes data provided.
License
Licensed under the GNU GPL v3. See the LICENSE file for the full license
text.
Metadata
Release files for libimagequant-integrations 1.1.1
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 |
|---|---|---|---|---|
| libimagequant_integrations-1.1.1.tar.gz | 4.9 kB | Without provenance | Details for libimagequant_integrations-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| libimagequant_integrations-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for libimagequant_integrations-1.1.1-py3-none-any.whl |
Total release size: 23.8 kB
Release files / libimagequant_integrations-1.1.1.tar.gz
| Download URL | libimagequant_integrations-1.1.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e25f99dd902b38f18616bec897289378d4dbc3a6b69dc855a28513f14d6d5dfa
|
|
BLAKE2b-256 checksum How to use checksums |
913c321d4cbe44c188fd23c50a9eacc6a8a17f4427f6222263a14d680323fc58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
|
Release files / libimagequant_integrations-1.1.1-py3-none-any.whl
| Download URL | libimagequant_integrations-1.1.1-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8234d667b189c5515fcdb69e26e75e45d54bca44b04c12dfd86233a9810b027c
|
|
BLAKE2b-256 checksum How to use checksums |
358be8fe869d158d229d4d0acf79ef8b8b245d53affe8a7b27d52e8738684e5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
|
Security for libimagequant-integrations 1.1.1
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.