Skip to main content

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

Project description

codecov Build Status

pylibjpeg-libjpeg

A Python 3.6+ wrapper for Thomas Richter's libjpeg, with a focus on use as a plugin for pylibjpeg.

Linux, OSX 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 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

import pylibjpeg

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())

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pylibjpeg-libjpeg, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pylibjpeg_libjpeg-1.0.0-cp36-cp36m-macosx_10_6_intel.whl (2.2 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp36-cp36m-manylinux2010_i686.whl (3.5 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp36-cp36m-manylinux2010_x86_64.whl (4.2 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp36-cp36m-win32.whl (1.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp36-cp36m-win_amd64.whl (1.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp37-cp37m-macosx_10_6_intel.whl (2.2 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp37-cp37m-manylinux2010_i686.whl (3.5 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp37-cp37m-manylinux2010_x86_64.whl (4.2 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp37-cp37m-win32.whl (1.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp37-cp37m-win_amd64.whl (1.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp38-cp38-manylinux2010_i686.whl (3.5 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp38-cp38-manylinux2010_x86_64.whl (4.2 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp38-cp38-win32.whl (1.7 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pylibjpeg_libjpeg-1.0.0-cp38-cp38-win_amd64.whl (1.7 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pylibjpeg-libjpeg-1.0.0.tar.gz (592.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page