skillfed

pylibjpeg-openjpeg

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

pylibjpeg-openjpeg v2.5.0 225.1K downloads/30d#9,228 on PyPI21
Permissive license MIT Active released

What it is and what it does

pylibjpeg-openjpeg is a Python wrapper around the OpenJPEG library that adds JPEG 2000 image codec support to Python. It can decode JPEG 2000 files (including High-Throughput variants) into NumPy arrays and encode NumPy arrays back into JPEG 2000 format with both lossless and lossy compression options. The package is designed primarily as a plugin for pylibjpeg, which integrates it into pydicom workflows for reading DICOM files compressed with JPEG 2000 codecs, but it also works standalone for direct image encoding and decoding.

The package supports a range of NumPy dtypes (bool, int8, uint8, int16, uint16, int32, uint32) and array shapes (grayscale, RGB, and 4-channel), with configurable compression via compression ratios or peak signal-to-noise ratios for lossy encoding. Installation uses prebuilt wheels for common platforms and Python versions, though building from source requires CMake and a C++ compiler.

Use it for:

  • Decompress JPEG 2000–encoded DICOM medical images in pydicom workflows without external tools.
  • Batch convert JPEG 2000 image files to NumPy arrays for scientific or medical image analysis.
  • Encode medical or scientific imaging data to lossless JPEG 2000 for archival or transmission.
  • Lossy compression of large grayscale or multispectral images using compression ratios or quality targets.
  • Integrate JPEG 2000 support into image processing pipelines that already use NumPy and pydicom.

Worth the install?

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

Decodes and encodes JPEG 2000 images to and from NumPy arrays, with built-in support for use as a pylibjpeg plugin for DICOM image decompression.

Yes, if you need JPEG 2000 codec support in Python—particularly for DICOM workflows via pydicom. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and offers prebuilt wheels for most platforms. Install friction is moderate due to compiled dependencies, but wheels eliminate build requirements for standard environments. Not necessary if you only work with standard JPEG or PNG formats.

Install

pylibjpeg-openjpeg on PyPI

pip

pip install pylibjpeg-openjpeg

uv

uv add pylibjpeg-openjpeg

poetry

poetry add pylibjpeg-openjpeg

Installing pylibjpeg-openjpeg

Before you install

Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10, 3.11, 3.12, and 3.13 on Linux, macOS (x86_64 and ARM64), and Windows. Building from source requires CMake and a C++ compiler. Last release 360 days ago; repository is active with recent commits.

License in practice

MIT license (permissive); no restrictions on commercial or private use, modification, or redistribution as long as the license and copyright notice are included.

Quickstart

import numpy as np
from openjpeg import decode, encode_array

# Decode a JPEG 2000 file
arr = decode('filename.j2k')

# Encode a NumPy array
data = np.random.randint(0, 65536, (100, 100, 3), dtype='uint8')
encode_array(data, photometric_interpretation=1)

Requires NumPy; building from source requires Python 3.9+, CMake, Git, and a C++ compiler (Microsoft Build Tools on Windows).

Verify before relying

  • Performance characteristics for large images or batch processing workflows.
  • Whether lossy encoding quality settings are well-documented or require trial-and-error tuning.
  • Integration maturity with current pydicom versions and DICOM transfer syntax support coverage.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 360 days since the last release
Last repo commit
First released
Downloads 225,091/month — #9,228 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pylibjpeg_openjpeg-2.5.0-cp310-cp310-macosx_10_9_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp310-cp310-macosx_11_0_arm64.whl; pylibjpeg_openjpeg-2.5.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pylibjpeg_openjpeg-2.5.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp310-cp310-win32.whl; pylibjpeg_openjpeg-2.5.0-cp310-cp310-win_amd64.whl; pylibjpeg_openjpeg-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp311-cp311-macosx_11_0_arm64.whl; pylibjpeg_openjpeg-2.5.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pylibjpeg_openjpeg-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp311-cp311-win32.whl; pylibjpeg_openjpeg-2.5.0-cp311-cp311-win_amd64.whl; pylibjpeg_openjpeg-2.5.0-cp312-cp312-macosx_10_13_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp312-cp312-macosx_11_0_arm64.whl; pylibjpeg_openjpeg-2.5.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pylibjpeg_openjpeg-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp312-cp312-win32.whl; pylibjpeg_openjpeg-2.5.0-cp312-cp312-win_amd64.whl; pylibjpeg_openjpeg-2.5.0-cp313-cp313-macosx_10_13_x86_64.whl; pylibjpeg_openjpeg-2.5.0-cp313-cp313-macosx_11_0_arm64.whl

Keywords: dicom, pydicom, python, imaging, jpg, jpeg, jpeg2k, jpeg2000, pylibjpeg, openjpeg

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

Tags

jpeg 2000 decoder pythonopenjpeg wrapperdicom jpeg2000 decompressionnumpy image encoding decodingpylibjpeg pluginj2k image processinglossless lossy jpeg2000
medical-imagingjpeg2000dicom

More Libraries packages