# How to convert .png images to DICOM files in a batch

**URL:** <https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768>\
**Category:** Support\
**Created:** [January 6, 2018, 12:38am UTC](https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768 "2018-01-06T00:38:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [January 6, 2018, 12:38am UTC](https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768/1 "2018-01-06T00:38:01Z")

</div>

Operating system:  
Slicer version:  
Expected behavior:  
Actual behavior:  
I have a CTA with png format. Can we convert png images to DICOM files in a batch?  
Thanks

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 6, 2018, 6:33am UTC](https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768/2 "2018-01-06T06:33:08Z")

</div>

You can certainly do this with Slicer, but this should not be needed. Can you tell a bit more about your workflow?

Normally you don’t get medical images in png format. In png files you don’t have any metadata and if your CT images have only 8 bits per pixel (256 gray levels) then they may be unusable for clinical purposes.

Where these png files come from?

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [January 6, 2018, 6:54am UTC](https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768/3 "2018-01-06T06:54:19Z")

</div>

Thank you very much!  
I agree with you DICOM is the best format choise. But I got some pictures from my friend who are not a doctor, and I need convert these png files to DICOMs and then analysis. So can you give a tutorial to deal with it.  
Thanks!

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [January 6, 2018, 7:00am UTC](https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768/4 "2018-01-06T07:00:04Z")

</div>

> [@lassoan](#):
>
> get medical images in png format. In png files you don’t have any metadata and if your CT images have only 8 bits per pixel (256 gray levels) then they may be unusable for clinical purposes.
> 
> Where these png files come from

My friend photographed a group of sliced tissue cells through an electron microscope and hope me could hep rebuild a 3D picture.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 6, 2018, 3:11pm UTC](https://discourse.slicer.org/t/how-to-convert-png-images-to-dicom-files-in-a-batch/1768/5 "2018-01-06T15:11:14Z")

</div>

OK, when the images are not from a DICOM-capable device then importing from png makes sense.

I don’t think Slicer can easily export color images to DICOM. If you convert to grayscale using “Vector to scalar volume” module then you can export the volume to DICOM. Or, you can probably do it with pydicom and some Python scripting.

Instead of exporting, you may try perform all visualization and analysis in Slicer. Or, if you need limited 3D analysis then you may use ImageJ or other microscopy-oriented software.
