Document Automation Made Simple

How to convert DICOM files to JPG, PNG, and PDF

Learn how to convert DICOM (.dcm) medical images to JPG, PNG, and PDF programmatically. Windowing and compressed transfer syntaxes are handled automatically, multi-frame series become multi-page PDFs, and PDF/A output covers regulatory archiving.

Tomas, CEO

DICOM (.dcm) is the standard format for medical images - CT scans, MRI series, ultrasound, X-rays. It is excellent inside a hospital PACS and useless everywhere else: patients cannot open it, browsers cannot display it, and document systems cannot archive it. The fastest way to make a DICOM file viewable anywhere is to convert it to JPG, PNG, or PDF.

This guide shows how to do that programmatically with the DICOM to JPG, DICOM to PNG, and DICOM to PDF converters - including the medical-imaging details that generic image tools get wrong.

Why DICOM is harder than a normal image

A DICOM file is not just pixels. Three things routinely break naive converters, and the API handles all of them automatically:

  • Compressed transfer syntaxes. Pixel data may be stored as RLE, JPEG, JPEG-LS, or JPEG 2000 inside the DICOM envelope. All of them are decoded transparently.
  • Windowing (VOI LUT). Raw CT and MRI pixel values span a far wider range than a screen can show. The stored window center and width are applied automatically, so the output looks the way it does on a diagnostic workstation - not like a gray, washed-out rectangle.
  • Multi-frame series. A single .dcm file can hold a whole series of frames. You get one image per frame for JPG and PNG, or one page per frame in a single PDF.

Quick start: DICOM to JPG with one API call

curl -X POST https://v2.convertapi.com/convert/dcm/to/jpg \
 -H "Authorization: Bearer api_token" \
 -F "File=@/path/to/scan.dcm"

Swap jpg for png or pdf in the URL and the same call produces the other formats.

Choosing the output format

JPG is the right choice for sharing and web use - small files, universal support. Tune ImageQuality (percentage) and set explicit dimensions with ImageWidth and ImageHeight when you need thumbnails or fixed-size previews.

PNG is lossless - no compression artifacts on top of the rendered image - which makes it the safer choice for annotation workflows and zoomed review. TransparentColor can map a chosen color to transparency.

PDF turns scans into documents: attach them to reports, medical records, or insurance claims. Layout is controlled with PageSize, PageOrientation, and margin parameters, and a multi-frame series becomes one page per frame - a whole CT series in a single document.

For long-term archiving, add Pdfa=true to produce PDF/A-1b output that satisfies regulatory retention requirements. If compliance matters in your pipeline, see our guide on validating PDF/A compliance programmatically.

Converting specific frames

Multi-frame files accept the PageRange parameter with the same syntax as PDF tools - 5, 1-10, or 1,3,7-9 - so you can pull key frames out of a long series without converting everything:

curl -X POST https://v2.convertapi.com/convert/dcm/to/pdf \
 -H "Authorization: Bearer api_token" \
 -F "File=@/path/to/series.dcm" \
 -F "PageRange=1-12"

DICOM to JPG in Python

pip install convertapi
import convertapi

convertapi.api_credentials = 'api_token'

convertapi.convert('jpg', {
    'File': '/path/to/scan.dcm',
    'ImageQuality': 90
}, from_format = 'dcm').save_files('/path/to/images')

DICOM to PDF/A in C#

dotnet add package ConvertApi
using ConvertApiDotNet;

var convertApi = new ConvertApi("api_token");

var result = await convertApi.ConvertAsync("dcm", "pdf",
    new ConvertApiFileParam(@"C:\scans\series.dcm"),
    new ConvertApiParam("Pdfa", "true")
);

await result.SaveFilesAsync(@"C:\scans\archive");

The same pattern works in PHP, Java, Node.js, Go, and Ruby.

Patient privacy

DICOM headers carry protected health information - patient name, ID, birth date, institution. Two things matter when you convert:

  • The rendered JPG, PNG, or PDF contains pixels only; the DICOM header tags are not copied into the output file. Annotations burned into the image itself, however, remain visible - review for burned-in text before sharing.
  • Files are transferred over HTTPS, processed in memory, and deleted automatically after conversion. ConvertAPI is HIPAA compliant, with SOC 2 and ISO 27001 certifications - see the security and compliance overview.

Try it yourself: download the sample files

We converted two classic anonymized DICOM test files with default settings - no tuning.

Single image: a chest X-ray, converted straight to JPG and PNG. This is the actual JPG output:

Chest X-ray converted from DICOM to JPG

Multi-frame series: a cardiac angiography cine run - 137 frames stored in a single 2.6 MB DICOM with JPEG-compressed pixel data - converted to one PDF with a page per frame:

Frequently asked questions

How do I open a DCM file without special software?

Convert it. A DICOM file needs a dedicated viewer, but the JPG or PDF version opens on any phone, browser, or document system - which is usually what patients, referring physicians, and insurers actually need.

Does the conversion preserve diagnostic image quality?

The stored windowing is applied so the output matches the diagnostic presentation. Choose PNG for a lossless rendering; JPG at high ImageQuality is visually equivalent for sharing. For primary diagnosis, always use the original DICOM in a certified viewer.

What happens to multi-frame DICOM files?

JPG and PNG conversions return one image per frame; PDF puts every frame on its own page in a single document. Use PageRange to convert only the frames you need.

Is converting patient scans through an API HIPAA compliant?

ConvertAPI is HIPAA compliant: files are encrypted in transit, processed in memory, and deleted after conversion. The output image carries no DICOM header metadata.

Conclusion

DICOM to JPG, PNG, or PDF is one HTTP call - with transfer syntax decoding, windowing, and multi-frame handling done for you. Try your own scans in the interactive demo on the DICOM to JPG, DICOM to PNG, or DICOM to PDF pages.


Related converters

Ready to Streamline Your File Conversions?