Skip to main content

PyPI version Commit CI/CD Release CI/CD Documentation Status PyPI downloads Stars Contributors Wheel Status PyPi license Last commit

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

pip install jpeglib

or using the cloned repository

python setup.py install

⚠️ 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

import jpeglib

DCT

Get discrete cosine transform (DCT) coefficients and quantization matrices as numpy array

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

im.write_dct('output.jpeg')

Pixel data

Decompress the input.jpeg into spatial representation in numpy array with

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

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.

libjpeg version

It is possible to choose, which version of libjpeg should be used.

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

version = jpeglib.version.get()

You can also set a libjpeg version for a scope only.

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, University of Innsbruck, 2023.

Metadata

Release files for jpeglib 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jpeglib 1.0.2
File Size Uploaded
jpeglib-1.0.2.tar.gz 5.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for jpeglib 1.0.2
File
jpeglib-1.0.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
jpeglib-1.0.2-cp38-abi3-win32.whl CPython 3.8 abi3 Windows x86-32 Details
jpeglib-1.0.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
jpeglib-1.0.2-cp38-abi3-manylinux2010_i686.manylinux2014_i686.manylinux_2_12_i686.manylinux_2_17_i686.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-32, Linux glibc 2.12+ x86-32 Details
jpeglib-1.0.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
jpeglib-1.0.2-cp38-abi3-macosx_10_9_x86_64.whl CPython 3.8 abi3 macOS 10.9+ x86-64 Details
jpeglib-1.0.2-cp38-abi3-macosx_10_9_universal2.whl CPython 3.8 abi3 macOS 10.9+ universal2 (ARM64, x86-64) Details

Total release size: 105.5 MB

Release files / jpeglib-1.0.2.tar.gz

Download URL jpeglib-1.0.2.tar.gz
Size 5.7 MB
Tags Source
SHA-256 checksum
How to use checksums
25eadd5497c94771c53deb6aa6646f0030ac24509fa9c3b89e984e11390bf3d9
BLAKE2b-256 checksum
How to use checksums
99d75cadeb5790320923e205e5d682acdc63740bf40973d6bf15f7625a149eb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-win_amd64.whl

Download URL jpeglib-1.0.2-cp38-abi3-win_amd64.whl
Size 9.9 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
abcc0be1c0b6adbff02b3b42805474fddbf6ac3182d619117a7e7c5cfa8f9bd2
BLAKE2b-256 checksum
How to use checksums
bb5b542403cdd0330733eeef421e4adc833d9862ed9b071f1607defe1f5cbe87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-win32.whl

Download URL jpeglib-1.0.2-cp38-abi3-win32.whl
Size 9.4 MB
Tags CPython 3.8 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
0b2d25da03f8710181367a4f1143215ad872c63b61dcad6665258b7ed051a5fb
BLAKE2b-256 checksum
How to use checksums
a8c57d9d2e594b897b6c24fae5dcdd345bbcd3098f65e26943a12cb48a5d687d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL jpeglib-1.0.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 22.8 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
feef6e94c34cf8b27f7a888c1c8567c34686c32b1e6edb16716931e4ee18fece
BLAKE2b-256 checksum
How to use checksums
5af4d7b8c2d3934208963fd2388cf4316043cb6c8e8c7d55780b8d9a45b4f8b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-manylinux2010_i686.manylinux2014_i686.manylinux_2_12_i686.manylinux_2_17_i686.whl

Download URL jpeglib-1.0.2-cp38-abi3-manylinux2010_i686.manylinux2014_i686.manylinux_2_12_i686.manylinux_2_17_i686.whl
Size 22.1 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-32 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
e03cc447815efaf4cf0c22333ec207a9a8a0b9245bd0bafd15b30c2156ed1290
BLAKE2b-256 checksum
How to use checksums
b4b5d3f0560b0b420aa5dccac348598217be8691e6cdd5a5269c805b85fe2e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-macosx_11_0_arm64.whl

Download URL jpeglib-1.0.2-cp38-abi3-macosx_11_0_arm64.whl
Size 10.5 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1e97ed4c232d0a76b80d823ac8a72ce0e8c68003929de599c27423dfdacf5e96
BLAKE2b-256 checksum
How to use checksums
d89e3e72638f1baf356edc683aad86c08034b5facdec912253be846dc0a60ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-macosx_10_9_x86_64.whl

Download URL jpeglib-1.0.2-cp38-abi3-macosx_10_9_x86_64.whl
Size 10.7 MB
Tags CPython 3.8 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
7d160a4b0169e737fef2b3a8e58074ccb463425baf47725ff480818fd26dd4ff
BLAKE2b-256 checksum
How to use checksums
3354d55db299c1572199847ef0707e1855e5a9f1d33abebc3148405c0760446d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / jpeglib-1.0.2-cp38-abi3-macosx_10_9_universal2.whl

Download URL jpeglib-1.0.2-cp38-abi3-macosx_10_9_universal2.whl
Size 14.5 MB
Tags CPython 3.8 abi3 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
fa065e7239664facd4a4c8910968ca729c75ad811aa36b23e3b8dba14d3163b2
BLAKE2b-256 checksum
How to use checksums
8fbd1e49f362ad057d237f27a5c4ef7bc35adc6e1928dab51dce3c565ad44d79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release history Release notifications | RSS feed

This release

1.0.2 This release

8 release files

1.0.1

8 release files

1.0.0

8 release files

0.14.0

8 release files

0.13.0

8 release files

0.12.8

8 release files

0.12.6

8 release files

0.12.5

8 release files

0.12.4

8 release files

0.12.1

8 release files

0.12.0

8 release files

0.11.8

8 release files

0.11.7

8 release files

0.11.6

8 release files

0.11.5

8 release files

0.11.4

8 release files

0.11.3

8 release files

0.11.2

8 release files

0.11.1

8 release files

0.11.0

8 release files

0.10.11

1 release file

0.10.10

1 release file

0.10.9

1 release file

0.10.8

1 release file

0.10.7

1 release file

0.10.6

1 release file

0.10.5

1 release file

0.10.4

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.15

1 release file

0.6.14

1 release file

0.6.13

1 release file

0.6.12

1 release file

0.6.11

1 release file

0.6.10

1 release file

0.6.9

1 release file

0.6.8

1 release file

0.6.7

1 release file

0.6.6

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.9

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.4.10

1 release file

0.4.9

1 release file

0.4.8

1 release file

0.4.7

1 release file

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page