skillfed

pylibjpeg

A Python framework for decoding JPEG and decoding/encoding DICOM RLE data, with a focus on supporting pydicom

pylibjpeg v2.1.0 275.7K downloads/30d#8,172 on PyPI53
Permissive license Active released

What it is and what it does

pylibjpeg is a Python framework that provides decoding and encoding for JPEG, JPEG-LS, JPEG 2000, and RLE compressed image formats. It integrates with DICOM medical imaging workflows, allowing transparent decompression of pixel data when reading DICOM files that use these compression schemes. The package can also decode JPEG images directly to numpy arrays standalone.

The package itself depends only on numpy and is lightweight. Its actual functionality requires installing one or more optional plugins: pylibjpeg-libjpeg (for JPEG variants, GPLv3), pylibjpeg-openjpeg (for JPEG 2000, MIT/BSD), or pylibjpeg-rle (for RLE, MIT). This modular design lets you install only the decoders and encoders you need. The framework is actively maintained, supports Python 3.10 through 3.14, and is classified as production-stable.

Use it for:

  • Read DICOM medical images compressed with JPEG Baseline or JPEG Lossless and extract pixel data.
  • Decompress DICOM files using JPEG 2000 compression for downstream analysis.
  • Encode pixel data to RLE Lossless format and save as compressed DICOM files.
  • Standalone decoding of JPEG files to numpy arrays.
  • Handle DICOM datasets with multiple compression schemes by installing plugins as needed.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Decodes and encodes JPEG, JPEG-LS, JPEG 2000, and RLE image formats, primarily for use with DICOM medical imaging data.

Yes, if you work with compressed DICOM medical images or need JPEG/JPEG 2000/RLE decoding. Low install friction, permissive license, active maintenance, and production-stable status make it solid. Install only if you also install at least one format-specific plugin; the base package alone cannot decode or encode. No known security vulnerabilities.

Install

pylibjpeg on PyPI

pip

pip install pylibjpeg

uv

uv add pylibjpeg

poetry

poetry add pylibjpeg

Installing pylibjpeg

Before you install

Low friction install with a single runtime dependency (numpy). Active maintenance with recent commits and production-stable status. Requires optional plugin packages to actually decode or encode specific formats.

License in practice

Permissive license treatment allows commercial and private use without restriction. Note that optional libjpeg plugin carries GPLv3, which has stronger copyleft requirements if used.

Quickstart

pip install pylibjpeg

from pylibjpeg import decode

# Decode a JPEG file to numpy array
arr = decode('filename.jpg')

# Or bytes
with open('filename.jpg', 'rb') as f:
    arr = decode(f.read())

Requires Python >=3.10. At least one format-specific plugin must be installed to decode or encode images.

Verify before relying

  • Performance characteristics for large medical imaging datasets.
  • Exact pydicom version compatibility beyond v2.1+ stated in description.
  • Whether all DICOM Transfer Syntax UIDs listed are fully supported or have limitations.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 347 days since the last release
Last repo commit
First released
Downloads 275,669/month — #8,172 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pylibjpeg-2.1.0-py3-none-any.whl

Keywords: dicom, pydicom, python, imaging, jpg, jpeg, jpg-ls, jpeg-ls, jpeg2k, jpeg2000, rle

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Healthcare IndustryIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: Medical Science Apps.Topic :: Software Development :: Libraries

Tags

DICOM image decompressionJPEG decoding medical imagingJPEG 2000 encoder decoderRLE lossless compressionmedical image format conversionDICOM transfer syntax supportcompressed medical imaging
medical-imagingdicomimage-compression

More Libraries packages