[![PyPI version](https://badge.fury.io/py/jpeglib.svg)](https://pypi.org/project/jpeglib/)
[![Commit CI/CD](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_commit.yml/badge.svg?branch=master)](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_commit.yml)
[![Release CI/CD](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_release.yml/badge.svg)](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_release.yml)
[![Documentation Status](https://readthedocs.org/projects/jpeglib/badge/?version=latest)](https://jpeglib.readthedocs.io/)
[![PyPI downloads](https://img.shields.io/pypi/dm/jpeglib)](https://pypi.org/project/jpeglib/)
[![Stars](https://img.shields.io/github/stars/martinbenes1996/jpeglib.svg)](https://GitHub.com/martinbenes1996/jpeglib)
[![Contributors](https://img.shields.io/github/contributors/martinbenes1996/jpeglib)](https://GitHub.com/martinbenes1996/jpeglib)
[![Wheel](https://img.shields.io/pypi/wheel/jpeglib)](https://pypi.org/project/jpeglib/)
[![Status](https://img.shields.io/pypi/status/jpeglib)](https://pypi.com/project/jpeglib/)
[![PyPi license](https://badgen.net/pypi/license/pip/)](https://pypi.com/project/jpeglib/)
[![Last commit](https://img.shields.io/github/last-commit/martinbenes1996/jpeglib)](https://GitHub.com/martinbenes1996/jpeglib)
# jpeglib
Python envelope for the popular C library libjpeg for handling JPEG files.
*libjpeg* offers full control over compression and decompression and exposes DCT coefficients and quantization tables.
## Installation
Simply install the package with pip3
```bash
pip install jpeglib
```
or using the cloned repository
```bash
python setup.py install
```
> :warning: This will install `jpeglib` together with multiple versions of libjpeg, libjpeg-turbo and mozjpeg. For common architectures/OS we provide prebuilt wheels, but installing from source takes couple of minutes.
## Usage
Import the library in Python 3
```python
import jpeglib
```
### DCT
Get *discrete cosine transform* (DCT) coefficients and quantization matrices as numpy array
```python
im = jpeglib.read_dct('input.jpeg')
im.Y; im.Cb; im.Cr; im.qt
```
You get luminance DCT, chrominance DCT and quantization tables.
Write the DCT coefficients back to a file with
```python
im.write_dct('output.jpeg')
```
### Pixel data
Decompress the `input.jpeg` into spatial representation in numpy array with
```python
im = jpeglib.read_spatial('input.jpeg')
im.spatial
```
You can specify parameters such as output color space, DCT method, dithering, etc.
Write spatial representation in numpy arrray back to file with
```python
im.write_spatial('output.jpeg')
```
You can specify input color space, DCT method, sampling factor, output quality, smoothing factor etc.
You can find all the details in the [documentation](https://jpeglib.readthedocs.io/).
### libjpeg version
It is possible to choose, which version of libjpeg should be used.
```python
jpeglib.version.set('6b')
```
Currently `jpeglib` supports all versions of libjpeg from 6b to 9e, libjpeg-turbo 2.1.0 and mozjpeg 4.0.3.
Their source codes is baked inside the package and thus distributed with it, avoiding external dependency.
Get currently used libjpeg version by
```python
version = jpeglib.version.get()
```
You can also set a libjpeg version for a scope only.
```python
jpeglib.version.set('6b')
im = jpeglib.read_spatial('image.jpeg') # using 6b
with jpeglib.version('9e'):
im = jpeglib.read_spatial('image.jpeg') # using 9e
im = jpeglib.read_spatial('image.jpeg') # using 6b again
```
## Credits
Developed by [Martin Benes](https://github.com/martinbenes1996), University of Innsbruck, 2023.
Raw data
{
"_id": null,
"home_page": "",
"name": "jpeglib",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "jpeglib,jpeg,jpg,libjpeg,compression,decompression,dct-coefficients,dct",
"author": "Martin Bene\u0161",
"author_email": "martinbenes1996@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f1/83/f63b2d41d7875a4275ce8f75857be4e3e4d5ce70a5d332ceb74da2438eab/jpeglib-1.0.0.tar.gz",
"platform": null,
"description": "[![PyPI version](https://badge.fury.io/py/jpeglib.svg)](https://pypi.org/project/jpeglib/)\n[![Commit CI/CD](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_commit.yml/badge.svg?branch=master)](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_commit.yml)\n[![Release CI/CD](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_release.yml/badge.svg)](https://github.com/martinbenes1996/jpeglib/actions/workflows/on_release.yml)\n[![Documentation Status](https://readthedocs.org/projects/jpeglib/badge/?version=latest)](https://jpeglib.readthedocs.io/)\n[![PyPI downloads](https://img.shields.io/pypi/dm/jpeglib)](https://pypi.org/project/jpeglib/)\n[![Stars](https://img.shields.io/github/stars/martinbenes1996/jpeglib.svg)](https://GitHub.com/martinbenes1996/jpeglib)\n[![Contributors](https://img.shields.io/github/contributors/martinbenes1996/jpeglib)](https://GitHub.com/martinbenes1996/jpeglib)\n[![Wheel](https://img.shields.io/pypi/wheel/jpeglib)](https://pypi.org/project/jpeglib/)\n[![Status](https://img.shields.io/pypi/status/jpeglib)](https://pypi.com/project/jpeglib/)\n[![PyPi license](https://badgen.net/pypi/license/pip/)](https://pypi.com/project/jpeglib/)\n[![Last commit](https://img.shields.io/github/last-commit/martinbenes1996/jpeglib)](https://GitHub.com/martinbenes1996/jpeglib)\n\n\n# jpeglib\n\nPython envelope for the popular C library libjpeg for handling JPEG files.\n\n*libjpeg* offers full control over compression and decompression and exposes DCT coefficients and quantization tables.\n\n## Installation\n\nSimply install the package with pip3\n\n\n```bash\npip install jpeglib\n```\n\nor using the cloned repository\n\n```bash\npython setup.py install\n```\n\n\n> :warning: This will install `jpeglib` together with multiple versions of libjpeg, libjpeg-turbo and mozjpeg. For common architectures/OS we provide prebuilt wheels, but installing from source takes couple of minutes.\n\n## Usage\n\nImport the library in Python 3\n\n```python\nimport jpeglib\n```\n\n### DCT\n\nGet *discrete cosine transform* (DCT) coefficients and quantization matrices as numpy array\n\n\n```python\nim = jpeglib.read_dct('input.jpeg')\nim.Y; im.Cb; im.Cr; im.qt\n```\n\nYou get luminance DCT, chrominance DCT and quantization tables.\n\nWrite the DCT coefficients back to a file with\n\n```python\nim.write_dct('output.jpeg')\n```\n\n### Pixel data\n\nDecompress the `input.jpeg` into spatial representation in numpy array with\n\n```python\nim = jpeglib.read_spatial('input.jpeg')\nim.spatial\n```\n\nYou can specify parameters such as output color space, DCT method, dithering, etc.\n\nWrite spatial representation in numpy arrray back to file with\n\n```python\nim.write_spatial('output.jpeg')\n```\n\nYou can specify input color space, DCT method, sampling factor, output quality, smoothing factor etc.\n\nYou can find all the details in the [documentation](https://jpeglib.readthedocs.io/).\n\n### libjpeg version\n\nIt is possible to choose, which version of libjpeg should be used.\n\n```python\njpeglib.version.set('6b')\n```\n\nCurrently `jpeglib` supports all versions of libjpeg from 6b to 9e, libjpeg-turbo 2.1.0 and mozjpeg 4.0.3.\nTheir source codes is baked inside the package and thus distributed with it, avoiding external dependency.\n\nGet currently used libjpeg version by\n\n```python\nversion = jpeglib.version.get()\n```\n\nYou can also set a libjpeg version for a scope only.\n\n```python\njpeglib.version.set('6b')\nim = jpeglib.read_spatial('image.jpeg') # using 6b\nwith jpeglib.version('9e'):\n im = jpeglib.read_spatial('image.jpeg') # using 9e\nim = jpeglib.read_spatial('image.jpeg') # using 6b again\n```\n\n\n## Credits\n\nDeveloped by [Martin Benes](https://github.com/martinbenes1996), University of Innsbruck, 2023.\n\n",
"bugtrack_url": null,
"license": "MPL",
"summary": "Python envelope for the popular C library libjpeg for handling JPEG files.",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://jpeglib.readthedocs.io/en/latest/",
"Homepage": "https://pypi.org/project/jpeglib/",
"Source": "https://github.com/martinbenes1996/jpeglib/"
},
"split_keywords": [
"jpeglib",
"jpeg",
"jpg",
"libjpeg",
"compression",
"decompression",
"dct-coefficients",
"dct"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "93aa65f0ea4f0bf6e2918c3ac544b145846df9eae0c4f4a938f3c0195438944c",
"md5": "f350a5044180d59b0ede2eb64ce6648d",
"sha256": "015a5043d0e6d345d2f41aaf872ed03bf69275b19ecac375c0a815862dd2e006"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-macosx_10_9_universal2.whl",
"has_sig": false,
"md5_digest": "f350a5044180d59b0ede2eb64ce6648d",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 13685077,
"upload_time": "2023-11-22T10:50:12",
"upload_time_iso_8601": "2023-11-22T10:50:12.565767Z",
"url": "https://files.pythonhosted.org/packages/93/aa/65f0ea4f0bf6e2918c3ac544b145846df9eae0c4f4a938f3c0195438944c/jpeglib-1.0.0-cp38-abi3-macosx_10_9_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "49994cbbde28e1f6a4fbd94c3a6bfd91bc1319ce54b2ce00719196a1cd6619dd",
"md5": "2279539c3f8dcb52c659c236c825463d",
"sha256": "eb31cc39fbcd96b1edbb3b92075fed64328d82e7840dea912ce7f441aef19811"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "2279539c3f8dcb52c659c236c825463d",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 10140378,
"upload_time": "2023-11-22T10:50:16",
"upload_time_iso_8601": "2023-11-22T10:50:16.190547Z",
"url": "https://files.pythonhosted.org/packages/49/99/4cbbde28e1f6a4fbd94c3a6bfd91bc1319ce54b2ce00719196a1cd6619dd/jpeglib-1.0.0-cp38-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3589816f22265188e4ec683c0284640d1b59decc9b11a267dc5e3380557c8c07",
"md5": "a32378cb32e771408699d85d20690493",
"sha256": "d207a659723bd730d5e89b647852f5b62abcca988f20afd2935e32a94f59a452"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "a32378cb32e771408699d85d20690493",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 10015109,
"upload_time": "2023-11-22T10:50:20",
"upload_time_iso_8601": "2023-11-22T10:50:20.090217Z",
"url": "https://files.pythonhosted.org/packages/35/89/816f22265188e4ec683c0284640d1b59decc9b11a267dc5e3380557c8c07/jpeglib-1.0.0-cp38-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20dee648fbcf0bb09e61f15abf56bbe02cf9c6936736ef97e91d50a0d83aea2e",
"md5": "e369759172209afaae4687b2bec7024d",
"sha256": "57937a46fe420bd292c5f7dee7a78e9132740512858f98ca4b3d533b9dc49883"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
"has_sig": false,
"md5_digest": "e369759172209afaae4687b2bec7024d",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 21104102,
"upload_time": "2023-11-22T10:50:23",
"upload_time_iso_8601": "2023-11-22T10:50:23.621002Z",
"url": "https://files.pythonhosted.org/packages/20/de/e648fbcf0bb09e61f15abf56bbe02cf9c6936736ef97e91d50a0d83aea2e/jpeglib-1.0.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2b9a905e89b8b4cbad594c49b547a805d88d6419f5b000b9f439e0cb8d2d8402",
"md5": "bdf881e9d0a689a92f4c0200895f9c4a",
"sha256": "5a19bb64edd9b0b6551b893ee9e5728fcfe0e0e828a3c4b9b5f548075c44dbf1"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "bdf881e9d0a689a92f4c0200895f9c4a",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 21702633,
"upload_time": "2023-11-22T10:50:27",
"upload_time_iso_8601": "2023-11-22T10:50:27.664056Z",
"url": "https://files.pythonhosted.org/packages/2b/9a/905e89b8b4cbad594c49b547a805d88d6419f5b000b9f439e0cb8d2d8402/jpeglib-1.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "38ffcf212c3955263f8b8650ae57e17c98fe11a2af048965958e3f22256c75ce",
"md5": "6b106f40d2ff29d9db9c6a971d06f820",
"sha256": "f3714aa038de4a8527ce51b41d5d42f60db1052b507bd3787fb61c82c1dbcb24"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-win32.whl",
"has_sig": false,
"md5_digest": "6b106f40d2ff29d9db9c6a971d06f820",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 8938061,
"upload_time": "2023-11-22T10:50:31",
"upload_time_iso_8601": "2023-11-22T10:50:31.234615Z",
"url": "https://files.pythonhosted.org/packages/38/ff/cf212c3955263f8b8650ae57e17c98fe11a2af048965958e3f22256c75ce/jpeglib-1.0.0-cp38-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "33c6504daf0c70279f016d88e7823628162d000f24a7d6883a571175f5ce29a1",
"md5": "89dbaeb8bb82ae4e357c311d66b0b4bf",
"sha256": "c6401374eadec6f94f3f7235e2a8b6f1c4a371362b84cf21c9ff12fe88639170"
},
"downloads": -1,
"filename": "jpeglib-1.0.0-cp38-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "89dbaeb8bb82ae4e357c311d66b0b4bf",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 9344529,
"upload_time": "2023-11-22T10:50:35",
"upload_time_iso_8601": "2023-11-22T10:50:35.026675Z",
"url": "https://files.pythonhosted.org/packages/33/c6/504daf0c70279f016d88e7823628162d000f24a7d6883a571175f5ce29a1/jpeglib-1.0.0-cp38-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f183f63b2d41d7875a4275ce8f75857be4e3e4d5ce70a5d332ceb74da2438eab",
"md5": "f4f8e10b0acadc833c11e6cd182925cb",
"sha256": "2d14a4f12cba29dd1ae92ffb31527c54be313d0521df8931e04cf54292f4d8e0"
},
"downloads": -1,
"filename": "jpeglib-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f4f8e10b0acadc833c11e6cd182925cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5423581,
"upload_time": "2023-11-22T10:50:37",
"upload_time_iso_8601": "2023-11-22T10:50:37.992099Z",
"url": "https://files.pythonhosted.org/packages/f1/83/f63b2d41d7875a4275ce8f75857be4e3e4d5ce70a5d332ceb74da2438eab/jpeglib-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-22 10:50:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "martinbenes1996",
"github_project": "jpeglib",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "jpeglib"
}