Unsupported JPEG data precision 12


I’m hoping someone here has had this problem before and can help me figure out how to deal with it. I’m attempting to load a DICOM image series, but when I try to load it I get the following message:

Unsupported JPEG data precision 12 Warning: In /build/gdcm-_MwJro/gdcm-2.6.6/Source/MediaStorageAndFileFormat/gdcmJPEGCodec.cxx, line 376, function virtual bool gdcm::JPEGCodec::DecodeByStreams(std::istream&, std::ostream&) DICOM header said it was 16 but JPEG header says it's: 12

I use GDCM through ITK to read the files, but it seems GDCM is unable to read them. Other GDCM based tools (like gdcmraw) give the same error when I try to extract the image data. DCMTK, on the other hand, is capable of reading the files just fine, but DCMTK usage has been deprecated in ITK, right?

Does anyone know how I should go about reading these files using ITK?

Best regards,

Hi Mads,

DCMTK support is also available in ITK (it is recommended to try ITK Git master). Please give it a try.


CC: @fbudin

Thanks for your answer Matt. I have switched to DCMTK now, and it now seems to read the files just fine. I still have some errors, but I think that’s down to my own code now :wink:

Is it the plan to keep support for both GDCM and DCMTK within ITK?

Best regards,

GDCM was recently updated in ITK master. There were JPEG related fixes, but I don’t know if this particular issue was fixed. You could also try building GDCM master itself and trying the gdcminfo command, then you’d at least have ITK excluded from being the cause.


Yes, and DICOM support in general is actively improving.

It’s definitely GDCM that’s the problem, not ITK. As I mentioned, the gdcmraw utility gives the exact same error. I’ve tried it with GDCM 2.8.2. I’ll try 2.8.3 at some point as that is the most recent version.

Great. I’ve switched to DCMTK and everything seems to work now :wink: I’ll stick with that for now - at least when working with these data sets.


I am receiving this error Unsupported JPEG data precision 12 in a pydicom pipeline with GDCM also installed. Any suggested fix? Perhaps I could convert these files using DCMTK to an encoding that GDCM understands?


1 Like