--- id: pylibjpeg-openjpeg version: "2.5.0" license: MIT license_treatment: permissive maintenance: active --- # pylibjpeg-openjpeg — A Python wrapper for openjpeg, with a focus on use as a plugin for for pylibjpeg License: permissive · Maintenance: active · Downloads: 225.1K/mo ## 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 above — 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 pip install pylibjpeg-openjpeg uv add pylibjpeg-openjpeg 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_current - Install friction: medium - Maintenance: active - Downloads: 225.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags jpeg 2000 decoder python, openjpeg wrapper, dicom jpeg2000 decompression, numpy image encoding decoding, pylibjpeg plugin, j2k image processing, lossless lossy jpeg2000, medical-imaging, jpeg2000, dicom [View on SkillFed](https://skillfed.io/packages/pylibjpeg-openjpeg) · [View on PyPI](https://pypi.org/project/pylibjpeg-openjpeg/)