# Unsupported JPEG data precision 12

**URL:** https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348
**Category:** Engineering
**Created:** [October 23, 2017, 1:12pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348 "2017-10-23T13:12:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![madsdk](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@madsdk](https://discourse.itk.org/u/madsdk)
#### Post date: [October 23, 2017, 1:12pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/1 "2017-10-23T13:12:32Z")

</div>

Hello,

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,  
Mads

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [October 23, 2017, 3:58pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/2 "2017-10-23T15:58:15Z")

</div>

Hi Mads,

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

Thanks,  
Matt

CC: @fbudin

---

<div class="post-metadata">

### Author: ![madsdk](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@madsdk](https://discourse.itk.org/u/madsdk)
#### Post date: [October 24, 2017, 7:16am UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/3 "2017-10-24T07:16:24Z")

</div>

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 😉

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

Best regards,  
Mads

---

<div class="post-metadata">

### Author: ![seanm](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@seanm](https://discourse.itk.org/u/seanm)
#### Post date: [October 24, 2017, 2:23pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/4 "2017-10-24T14:23:32Z")

</div>

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.

Sean

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [October 24, 2017, 6:00pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/5 "2017-10-24T18:00:14Z")

</div>

> [@madsdk](#):
>
> Is it the plan to keep support for both GDCM and DCMTK within ITK?

Yes, and DICOM support in general is actively improving.

---

<div class="post-metadata">

### Author: ![madsdk](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@madsdk](https://discourse.itk.org/u/madsdk)
#### Post date: [October 24, 2017, 7:28pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/6 "2017-10-24T19:28:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![madsdk](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@madsdk](https://discourse.itk.org/u/madsdk)
#### Post date: [October 24, 2017, 7:29pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/7 "2017-10-24T19:29:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Akshay\_Goel](https://discourse.itk.org/user_avatar/discourse.itk.org/akshay_goel/32/1878_2.png) [@Akshay\_Goel](https://discourse.itk.org/u/Akshay_Goel)
#### Post date: [March 16, 2021, 10:17pm UTC](https://discourse.itk.org/t/unsupported-jpeg-data-precision-12/348/8 "2021-03-16T22:17:44Z")

</div>

Hello,

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?

Thanks!  
-Akshay
