# Plugins for Pixel Data Compression and Decompression

## Plugins for Decompression

The table below lists the plugins available for decompressing pixel data that’s been compressed using the corresponding Transfer Syntax UID. No plugins are used for uncompressed pixel data.

Transfer Syntax | Plugins
--- | ---
Name | UID | `pylibjpeg` | `gdcm` | `pillow` | `pyjpegls` | `pydicom`
JPEG Baseline 8-bit | 1.2.840.10008.1.2.4.50 | ✓1 | ✓ | ✓ |  |
JPEG Extended 12-bit | 1.2.840.10008.1.2.4.51 | ✓1 | ✓ | ✓ |  |
JPEG Lossless P14 | 1.2.840.10008.1.2.4.57 | ✓1 | ✓ |  |  |
JPEG Lossless SV1 | 1.2.840.10008.1.2.4.70 | ✓1 | ✓ |  |  |
JPEG-LS Lossless | 1.2.840.10008.1.2.4.80 | ✓1 | ✓ |  | ✓ |
JPEG-LS Near Lossless | 1.2.840.10008.1.2.4.81 | ✓1 | ✓ |  | ✓ |
JPEG 2000 Lossless | 1.2.840.10008.1.2.4.90 | ✓2 | ✓ | ✓4 |  |
JPEG 2000 | 1.2.840.10008.1.2.4.91 | ✓2 | ✓ | ✓4 |  |
HTJ2K Lossless | 1.2.840.10008.1.2.4.201 | ✓2 |  |  |  |
HTJ2K Lossless RPCL | 1.2.840.10008.1.2.4.202 | ✓2 |  |  |  |
HTJ2K | 1.2.840.10008.1.2.4.203 | ✓2 |  |  |  |
RLE Lossless | 1.2.840.10008.1.2.5 | ✓3 | ✓ |  |  | ✓

1 with `pylibjpeg-libjpeg`
2 with `pylibjpeg-openjpeg`
3 with `pylibjpeg-rle`
4 with Pillow’s Jpeg2KImagePlugin

### Plugins

#### `pylibjpeg`

Requires pylibjpeg and at least one of:

- pylibjpeg-libjpeg

- pylibjpeg-openjpeg

- pylibjpeg-rle

Known limitations

- Maximum supported Bits Stored for JPEG 2000 and HTJ2K is 24

#### `gdcm`

Requires python-gdcm.

Known limitations

- JPEG Extended 12-bit is only available if Bits Allocated is 8

- JPEG-LS Near Lossless only if Bits Stored is at least 8 for a Pixel Representation of 1

- JPEG-LS Lossless and JPEG-LS Near Lossless only if Bits Stored is not 6 or 7

- Maximum supported Bits Stored is 16

#### `pillow`

Requires Pillow, with support for JPEG 2000 via Pillow’s Jpeg2KImagePlugin requiring OpenJPEG.

Known limitations

- JPEG Extended 12-bit is only available if Bits Allocated is 8

- JPEG 2000 Lossless and JPEG 2000 are only available for a Samples per Pixel of 3 when Bits Stored is <= 8

- Maximum supported Bits Stored is 16

#### `pyjpegls`

Requires pyjpegls.

#### `pydicom`

Requires pydicom.

Known limitations

- Slower than the other plugins by 3-4x

## Plugins for Compression

Transfer Syntax | Plugins | Encoding guide
--- | --- | ---
Name | UID
JPEG-LS Lossless | 1.2.840.10008.1.2.4.80 | `pyjpegls` | JPEG-LS
JPEG-LS Near Lossless | 1.2.840.10008.1.2.4.81
JPEG 2000 Lossless | 1.2.840.10008.1.2.4.90 | `pylibjpeg` | JPEG 2000
JPEG 2000 | 1.2.840.10008.1.2.4.91
RLE Lossless | 1.2.840.10008.1.2.5 | `pylibjpeg` | RLE
`pydicom`

### Plugins

#### `pyjpegls`

Requires pyjpegls.

#### `pylibjpeg`

Requires pylibjpeg as well as pylibjpeg-openjpeg for JPEG 2000 compression and pylibjpeg-rle for RLE Lossless.

Known limitations

- The maximum supported Bits Stored for JPEG 2000 is 24, however the results for 20-24 are very poor when using lossy compression.

#### `pydicom`

Requires pydicom.

Known limitations

- Much slower than the other plugins