Handling of compressed image data

How to get image data from compressed DICOM images


To be able to decompress compressed DICOM image data, you need to have one or more packages installed that are able to handle this kind of data. pydicom detects the installed packages and provides image data handlers that use the available packages.

The following packages can be used with pydicom:

  • GDCM - this is the package that supports most compressed formats
  • Pillow, ideally with jpeg and jpeg2000 plugins
  • jpeg_ls

Note that you always need the NumPy package to be able to handle image data.


We rely on the image handling capacity of the mentioned packages and cannot guarantee the correctness of the generated uncompressed images. Be sure to verify the correctness of generated images using other means before you use them for medical purposes.

Supported Transfer Syntaxes

As far as we have been able to verify, the following transfer syntaxes are handled by the given packages:

Transfer Syntax NumPy NumPy + JPEG-LS NumPy + GDCM NumPy + Pillow
Name UID
Explicit VR Little Endian 1.2.840.10008.1.2.1
Implicit VR Little Endian 1.2.840.10008.1.2
Explicit VR Big Endian 1.2.840.10008.1.2.2
Deflated Explicit VR Little Endian 1.2.840.10008.
RLE Lossless 1.2.840.10008.1.2.5
JPEG Baseline (Process 1) 1.2.840.10008.     1
JPEG Extended (Process 2 and 4) 1.2.840.10008.     1
JPEG Lossless (Process 14) 1.2.840.10008.      
JPEG Lossless (Process 14, SV1) 1.2.840.10008.    
JPEG LS Lossless 1.2.840.10008.    
JPEG LS Lossy 3 1.2.840.10008.    
JPEG2000 Lossless 1.2.840.10008.     2
JPEG2000 4 1.2.840.10008.       5
JPEG2000 Multi-component Lossless 1.2.840.10008.        
JPEG2000 Multi-component 1.2.840.10008.        
1 only with JpegImagePlugin
2 only with Jpeg2KImagePlugin
3 handled differently by Pillow and GDCM
4 no support for 8 bit Grayscale
5 not supported for > 8 bit


To use decompressed image data from compressed DICOM images, you have two options:

  • use decompress() on the dataset to convert it in-place and work with the pixel data as described before
  • get an uncompressed copy of the pixel data as a NumPy array using Dataset.pixel_array without touching the original dataset


Using decompress() adapts the transfer syntax of the data set, but not the Photometric Interpretation. The Photometric Interpretation may not match the pixel data, depending on the used decompression handler.