🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

pylibjpeg-libjpeg

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pylibjpeg-libjpeg

A Python wrapper for libjpeg, with a focus on use as a plugin for for pylibjpeg

2.3.0
PyPI
Maintainers
3

Build status Test coverage PyPI versions Python versions Code style: black

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

NumPy

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 StandardITU EquivalentJPEG Format
10918T.81JPEG
14495T.87JPEG-LS
18477JPEG XT

Encoding

Encoding of JPEG images is not currently supported

Supported Transfer Syntaxes

Decoding

UIDDescription
1.2.840.10008.1.2.4.50JPEG Baseline (Process 1)
1.2.840.10008.1.2.4.51JPEG Extended (Process 2 and 4)
1.2.840.10008.1.2.4.57JPEG Lossless, Non-Hierarchical (Process 14)
1.2.840.10008.1.2.4.70JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])
1.2.840.10008.1.2.4.80JPEG-LS Lossless
1.2.840.10008.1.2.4.81JPEG-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')

Keywords

dicom pydicom python jpg jpeg jpg-ls jpeg-ls libjpeg pylibjpeg

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts