A Python wrapper for libjpeg, with a focus on use as a plugin for for pylibjpeg
Project Links
Meta
Author: pylibjpeg-libjpeg contributors
Maintainer: scaramallion
Requires Python: >=3.9,<4.0
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
- Healthcare Industry
- Science/Research
License
- OSI Approved :: GNU General Public License v3 (GPLv3)
- Other/Proprietary License
Natural Language
- English
Operating System
- MacOS :: MacOS X
- Microsoft :: Windows
- POSIX :: Linux
Programming Language
- C++
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
Topic
- Scientific/Engineering :: Medical Science Apps.
- Software Development :: Libraries
pylibjpeg-libjpeg
A Python 3.8+ wrapper for Thomas Richter's libjpeg, with a focus on use as a plugin for pylibjpeg.
Linux, MacOS and Windows are all supported.
Installation
Dependencies
Installing the current release
pip install pylibjpeg-libjpeg
Installing the development version
Make sure Python and Git are installed. For Windows, you also need to install Microsoft's C++ Build Tools.
git clone --recurse-submodules https://github.com/pydicom/pylibjpeg-libjpeg
python -m pip install pylibjpeg-libjpeg
Supported JPEG Formats
Decoding
ISO/IEC Standard | ITU Equivalent | JPEG Format |
---|---|---|
10918 | T.81 | JPEG |
14495 | T.87 | JPEG-LS |
18477 | JPEG XT |
Encoding
Encoding of JPEG images is not currently supported
Supported Transfer Syntaxes
Decoding
UID | Description |
---|---|
1.2.840.10008.1.2.4.50 | JPEG Baseline (Process 1) |
1.2.840.10008.1.2.4.51 | JPEG Extended (Process 2 and 4) |
1.2.840.10008.1.2.4.57 | JPEG Lossless, Non-Hierarchical (Process 14) |
1.2.840.10008.1.2.4.70 | JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]) |
1.2.840.10008.1.2.4.80 | JPEG-LS Lossless |
1.2.840.10008.1.2.4.81 | JPEG-LS Lossy (Near-Lossless) Image Compression |
Usage
With pylibjpeg and pydicom
from pydicom import dcmread
from pydicom.data import get_testdata_file
ds = dcmread(get_testdata_file('JPEG-LL.dcm'))
arr = ds.pixel_array
Standalone JPEG decoding
You can also decode JPEG images to a numpy ndarray:
from libjpeg import decode
with open('filename.jpg', 'rb') as f:
# Returns a numpy array
arr = decode(f.read())
# Or simply...
arr = decode('filename.jpg')
Oct 27, 2024
2.3.0
Jun 18, 2024
2.2.0
Jun 17, 2024
2.1.1
Mar 29, 2024
2.1.0
Jan 21, 2024
2.0.2
Jan 20, 2024
2.0.1
Jan 07, 2024
2.0.0
Feb 20, 2023
1.3.4
Jan 15, 2023
1.3.3
Oct 02, 2022
1.3.2
Feb 03, 2022
1.3.1
Jan 22, 2022
1.3.0
Apr 10, 2021
1.2.0
Jun 13, 2020
1.1.0
Mar 16, 2020
1.0.0
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
(<3.0,>=2.0)
numpy