pylibjpeg-libjpeg is a Python wrapper for the `libjpeg` C library, designed primarily to function as a plugin for the `pylibjpeg` framework, which in turn provides JPEG decoding capabilities for `pydicom`. It enables Python applications to decode various JPEG formats, including JPEG Baseline, Extended, Lossless (Process 14), JPEG-LS Lossless, and Lossy. The library is actively maintained, with the current version being 2.4.0, and typically sees updates for Python version compatibility and `libjpeg` upgrades every few months to a year.
pip install pylibjpeg-libjpegVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the primary use case of `pylibjpeg-libjpeg` as a plugin for `pydicom` to decode JPEG-compressed DICOM pixel data. Once installed, `pydicom` (via `pylibjpeg`) automatically discovers and uses `pylibjpeg-libjpeg` for supported JPEG transfer syntaxes.
Upgrade to a supported Python version (currently >=3.10 and <4.0).
Ensure your NumPy version matches the requirements of your `pylibjpeg-libjpeg` and Python version. For `pylibjpeg-libjpeg` v2.3.0+, install `numpy>=2.0.0`.
Migrate any code using `utils.reconstruct()` to an alternative approach, likely involving direct pixel array manipulation with NumPy.
Use other libraries if JPEG encoding functionality is required.
Review image processing pipelines for potential endianness-related side effects if upgrading on a big-endian system.
Ensure `pylibjpeg-libjpeg` is correctly installed in the active Python environment (`pip install pylibjpeg-libjpeg`). Verify that a compatible wheel is available for your OS and Python version.
For PyInstaller, you might need to manually include `pylibjpeg-libjpeg` (and `libjpeg`) as hidden imports or provide custom hooks to ensure it's properly packaged. Consult PyInstaller's documentation on handling plugins and C extensions.
Ensure all pydicom-related libraries (pydicom, pylibjpeg, pylibjpeg-libjpeg) are installed from stable releases. If trying development versions, perform a clean uninstall of all components before reinstalling.