Python libimagequant Integrations
=================================
This library provides helper functions for converting between objects in the
[unofficial Python libimagequant bindings library](http://libimagequant-python.readthedocs.io/)
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's `PIL.Image.Image`[*](#pillow))
* `libimagequant_integrations.PySide2` (for `PySide2.QtGui.QImage`)
* `libimagequant_integrations.PySide6` (for `PySide6.QtGui.QImage`)
* `libimagequant_integrations.PyQt5` (for `PyQt5.QtGui.QImage`)
* `libimagequant_integrations.PyQt6` (for `PyQt6.QtGui.QImage`)
* `libimagequant_integrations.skimage` (for scikit-image numpy arrays<sup>[†](#skimage)</sup>)
* `libimagequant_integrations.png` (for PyPNG `png.Reader` and `png.Writer`<sup>[‡](#pypng)</sup>)
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.
<a name="pillow">*</a>
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.
<sup><a name="skimage">†</a></sup>
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).
<sup><a name="pypng">‡</a></sup>
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/RoadrunnerWMC/libimagequant-python-integrations",
"name": "libimagequant-integrations",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "",
"author": "RoadrunnerWMC",
"author_email": "roadrunnerwmc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/91/3c/321d4cbe44c188fd23c50a9eacc6a8a17f4427f6222263a14d680323fc58/libimagequant_integrations-1.1.1.tar.gz",
"platform": "",
"description": "Python libimagequant Integrations\n=================================\n\nThis library provides helper functions for converting between objects in the\n[unofficial Python libimagequant bindings library](http://libimagequant-python.readthedocs.io/)\nand \"image\" objects in various popular Python libraries.\n\nIf you'd like to add support for integration with more libraries, pull requests\nare welcome!\n\nInstall with pip:\n\n python3 -m pip install libimagequant_integrations\n\n\nAPI Documentation\n-----------------\n\nThis package contains the following submodules, for converting to/from the\nindicated classes:\n\n* `libimagequant_integrations.PIL` (for Pillow's `PIL.Image.Image`[*](#pillow))\n* `libimagequant_integrations.PySide2` (for `PySide2.QtGui.QImage`)\n* `libimagequant_integrations.PySide6` (for `PySide6.QtGui.QImage`)\n* `libimagequant_integrations.PyQt5` (for `PyQt5.QtGui.QImage`)\n* `libimagequant_integrations.PyQt6` (for `PyQt6.QtGui.QImage`)\n* `libimagequant_integrations.skimage` (for scikit-image numpy arrays<sup>[\u2020](#skimage)</sup>)\n* `libimagequant_integrations.png` (for PyPNG `png.Reader` and `png.Writer`<sup>[\u2021](#pypng)</sup>)\n\nI suggest you import using (for example)\n`import libimagequant_integrations.PyQt5 as liq_PyQt5`, to avoid typing an\nexcessive amount. :)\n\nEach submodule contains two functions, used to convert to and from the\n`libimagequant.Image` class:\n\n to_liq(image: OtherImageClass, attr: libimagequant.Attr) -> libimagequant.Image\n\n from_liq(result: libimagequant.Result, image: libimagequant.Image) -> OtherImageClass\n\n(Replace `OtherImageClass` with the appropriate other image class.)\n\nYou can check `libimagequant_integration`'s version number using\n`libimagequant_integrations.VERSION` and\n`libimagequant_integrations.VERSION_STR`, which are in the same format as the\nversion number constants in the `libimagequant` bindings library itself. The\nversion numbers follow semantic versioning. They begin with 1.0.0, and do not\ntrack libimagequant's version numbers at all.\n\n<a name=\"pillow\">*</a>\nWhile Pillow claims to support images with RGBA palettes, this feature seems\nextremely buggy, almost to the point of being completely unusable. Therefore,\nthe `from_liq()` function discards the alpha channel and returns an image with\na RGB palette. If you do need the alpha channel information, you can obtain it\nmanually from the `libimagequant.Image` object.\n\n<sup><a name=\"skimage\">\u2020</a></sup>\nGive `to_liq()` an RGBA image (numpy array of shape `(y, x, 4)`, with\nuint8-type elements) as its \"image\" argument. `from_liq()` returns two numpy\narrays: one with pixel data (shape `(y, x, 1)`, uint8-type elements), and one\nwith the RGBA color palette (shape `(n, 4)`, uint8-type elements).\n\n<sup><a name=\"pypng\">\u2021</a></sup>\nGive `to_liq()` a `png.Reader` as its \"image\" argument. `from_liq()` returns a\n`png.Writer` and a `bytes` object; you can save the image using the Writer's\n`write_array()` method with the `bytes` data provided.\n\nLicense\n-------\n\nLicensed under the GNU GPL v3. See the `LICENSE` file for the full license\ntext.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/RoadrunnerWMC/libimagequant-python-integrations"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "358be8fe869d158d229d4d0acf79ef8b8b245d53affe8a7b27d52e8738684e5a",
"md5": "a3cf89a0c9d4b21c8431cc4193a331d2",
"sha256": "8234d667b189c5515fcdb69e26e75e45d54bca44b04c12dfd86233a9810b027c"
},
"downloads": -1,
"filename": "libimagequant_integrations-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3cf89a0c9d4b21c8431cc4193a331d2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 18967,
"upload_time": "2021-03-15T01:58:04",
"upload_time_iso_8601": "2021-03-15T01:58:04.402951Z",
"url": "https://files.pythonhosted.org/packages/35/8b/e8fe869d158d229d4d0acf79ef8b8b245d53affe8a7b27d52e8738684e5a/libimagequant_integrations-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "913c321d4cbe44c188fd23c50a9eacc6a8a17f4427f6222263a14d680323fc58",
"md5": "57de4d484ce4c0c8bf8ed7e66eb2abfb",
"sha256": "e25f99dd902b38f18616bec897289378d4dbc3a6b69dc855a28513f14d6d5dfa"
},
"downloads": -1,
"filename": "libimagequant_integrations-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "57de4d484ce4c0c8bf8ed7e66eb2abfb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 4851,
"upload_time": "2021-03-15T01:58:05",
"upload_time_iso_8601": "2021-03-15T01:58:05.838805Z",
"url": "https://files.pythonhosted.org/packages/91/3c/321d4cbe44c188fd23c50a9eacc6a8a17f4427f6222263a14d680323fc58/libimagequant_integrations-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-03-15 01:58:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RoadrunnerWMC",
"github_project": "libimagequant-python-integrations",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "libimagequant-integrations"
}