[![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/stargazers)
[![Contributors](https://img.shields.io/github/contributors/martinbenes1996/jpeglib)](https://github.com/martinbenes1996/jpeglib/graphs/contributors)
[![Wheel](https://img.shields.io/pypi/wheel/jpeglib)](https://pypi.org/project/jpeglib/)
[![Status](https://img.shields.io/pypi/status/jpeglib)](https://pypi.org/project/jpeglib/)
[![PyPi license](https://badgen.net/pypi/license/jpeglib)](https://pypi.org/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": null,
"name": "jpeglib",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"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/a9/94/c90609243ad227fd96d61262f0e54662c4fb6a46c1a997d7187b205bf961/jpeglib-1.0.1.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/stargazers)\n[![Contributors](https://img.shields.io/github/contributors/martinbenes1996/jpeglib)](https://github.com/martinbenes1996/jpeglib/graphs/contributors)\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.org/project/jpeglib/)\n[![PyPi license](https://badgen.net/pypi/license/jpeglib)](https://pypi.org/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.1",
"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": "2966f0e71a64c0a9c10484f334a307aa397a2ba9a7e2896e8bfd75d21ac8df02",
"md5": "ec7b5123419cc80d6e158ae638d7bc1a",
"sha256": "9c75047075b3c4a9a72ceeaffdc411a2d54de20b75c560384d68ad611548f441"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-macosx_10_9_universal2.whl",
"has_sig": false,
"md5_digest": "ec7b5123419cc80d6e158ae638d7bc1a",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 14327219,
"upload_time": "2024-09-10T08:59:42",
"upload_time_iso_8601": "2024-09-10T08:59:42.568639Z",
"url": "https://files.pythonhosted.org/packages/29/66/f0e71a64c0a9c10484f334a307aa397a2ba9a7e2896e8bfd75d21ac8df02/jpeglib-1.0.1-cp38-abi3-macosx_10_9_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3fd659150a6546f161a224ea9e364d6e7fc313a221cc3b38470694052950a0a2",
"md5": "3198cff9ec551e4cce8710fc1dc9c933",
"sha256": "b00942be30803b08ec741cd255f9ef887cfe2f04a0a47bb1b0648bce7de1430b"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "3198cff9ec551e4cce8710fc1dc9c933",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 10623783,
"upload_time": "2024-09-10T08:59:45",
"upload_time_iso_8601": "2024-09-10T08:59:45.446092Z",
"url": "https://files.pythonhosted.org/packages/3f/d6/59150a6546f161a224ea9e364d6e7fc313a221cc3b38470694052950a0a2/jpeglib-1.0.1-cp38-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "509d97a4a7156805ee28e6086dbd4ed663ba60e1a66704f1ca341caea3128173",
"md5": "a98c7a4f73b191d2f325786d9b4fd2e9",
"sha256": "46867f31a161c44200fdc6ed87345fb322669131c49bdfc6aad836329a1bea20"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "a98c7a4f73b191d2f325786d9b4fd2e9",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 10465072,
"upload_time": "2024-09-10T08:59:48",
"upload_time_iso_8601": "2024-09-10T08:59:48.440475Z",
"url": "https://files.pythonhosted.org/packages/50/9d/97a4a7156805ee28e6086dbd4ed663ba60e1a66704f1ca341caea3128173/jpeglib-1.0.1-cp38-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "86fda83edf190ac93bdcd8837c8d437f6c5b357e46daa846558a6798efe1ec5e",
"md5": "78dd93649263521d9417c245e5b566ba",
"sha256": "97ace7371ded5aa710986061aa6fe5364175efa642e94ee1a75993fa8ab9607b"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
"has_sig": false,
"md5_digest": "78dd93649263521d9417c245e5b566ba",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 22160633,
"upload_time": "2024-09-10T08:59:51",
"upload_time_iso_8601": "2024-09-10T08:59:51.433655Z",
"url": "https://files.pythonhosted.org/packages/86/fd/a83edf190ac93bdcd8837c8d437f6c5b357e46daa846558a6798efe1ec5e/jpeglib-1.0.1-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": "0b846e665e5c021419102629f17420cda45343e88859f9bdd40bc69d2b786a88",
"md5": "96dac59a73046ba484a283d3168d743f",
"sha256": "00ba8a57f4fce30f969ca3cdf7988fc079d7ed32da83f63355a8a29abba635c1"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "96dac59a73046ba484a283d3168d743f",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 22729809,
"upload_time": "2024-09-10T08:59:54",
"upload_time_iso_8601": "2024-09-10T08:59:54.181146Z",
"url": "https://files.pythonhosted.org/packages/0b/84/6e665e5c021419102629f17420cda45343e88859f9bdd40bc69d2b786a88/jpeglib-1.0.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9d6916a043d5ac5675f0e807d25028b295ce9867543f3b40252a9d0a182085d3",
"md5": "401fadfd0ae7fc7dd740c5d548be3a66",
"sha256": "fc8d0231f76ab9599e2d27d18356c2c1298f91e31bae2e72221993d766c0e914"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-win32.whl",
"has_sig": false,
"md5_digest": "401fadfd0ae7fc7dd740c5d548be3a66",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 9369542,
"upload_time": "2024-09-10T08:59:56",
"upload_time_iso_8601": "2024-09-10T08:59:56.773514Z",
"url": "https://files.pythonhosted.org/packages/9d/69/16a043d5ac5675f0e807d25028b295ce9867543f3b40252a9d0a182085d3/jpeglib-1.0.1-cp38-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dc6063fbb88750dcb9fb3f497fc62446661b209d335e32e3541a29d0d98c154d",
"md5": "9c24ce034e9cf1c48be657f2b133b8ba",
"sha256": "0af1298258df10be186a31031cf49cc4ddbed2bb8bbda0d39ad99f207c6484bb"
},
"downloads": -1,
"filename": "jpeglib-1.0.1-cp38-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "9c24ce034e9cf1c48be657f2b133b8ba",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 9770633,
"upload_time": "2024-09-10T08:59:58",
"upload_time_iso_8601": "2024-09-10T08:59:58.957922Z",
"url": "https://files.pythonhosted.org/packages/dc/60/63fbb88750dcb9fb3f497fc62446661b209d335e32e3541a29d0d98c154d/jpeglib-1.0.1-cp38-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a994c90609243ad227fd96d61262f0e54662c4fb6a46c1a997d7187b205bf961",
"md5": "d68d6ebb4eabeb295baf54781f8c14aa",
"sha256": "3f6311b813b1df7342a865c278eeafbac9ccca41134200da7863dce74c36f384"
},
"downloads": -1,
"filename": "jpeglib-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "d68d6ebb4eabeb295baf54781f8c14aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5672930,
"upload_time": "2024-09-10T09:00:01",
"upload_time_iso_8601": "2024-09-10T09:00:01.138767Z",
"url": "https://files.pythonhosted.org/packages/a9/94/c90609243ad227fd96d61262f0e54662c4fb6a46c1a997d7187b205bf961/jpeglib-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-10 09:00:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "martinbenes1996",
"github_project": "jpeglib",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "wheel",
"specs": []
},
{
"name": "numpy",
"specs": []
}
],
"lcname": "jpeglib"
}