This article provides a comprehensive guide on how to convert DICOM images to JPG, PNG, BMP, and GIF formats in C# using the powerful Aspose.Imaging library.

Understanding DICOM
DICOM (Digital Imaging and Communications in Medicine) is a standardized file format widely used for storing and sharing medical imaging data. It encompasses datasets that include both header and image information, commonly found in medical scans such as ultrasounds and MRIs. These images are crucial for healthcare professionals to convey essential patient information.
While numerous offline and online DICOM viewers are available, embedding DICOM images in presentations or web pages often necessitates conversion to more universally accepted formats like JPG, GIF, PNG, or BMP. In this article, you will learn how to programmatically convert DICOM images using C#. By the end of this guide, you will be proficient in converting DICOM images into the following formats:
- JPG
- GIF
- PNG
- BMP
C# DICOM to JPG, GIF, PNG, and BMP Converter - Free Download
To convert DICOM images efficiently, we will utilize Aspose.Imaging for .NET, a user-friendly API designed for creating and manipulating various image types within .NET applications. You can find Aspose.Imaging for .NET on NuGet and download the binaries.
Convert DICOM to JPG in C#
To convert a DICOM file to JPG in C#, follow these steps:
- Load the DICOM file into a FileStream object.
- Create an instance of the DicomImage class and initialize it with the FileStream object.
- Select the active page in the DICOM file for conversion to JPG (the default active page will be used if none is set).
- Save the converted JPG image using the DicomImage.Save(string, ImageOptionsBase) method.
Here’s a code sample that demonstrates how to convert a DICOM page to JPG in C#:
Input DICOM Example

DICOM to JPEG Output

Convert DICOM to GIF in C#
Converting DICOM to GIF is a straightforward process. Simply access the DICOM file and save it with the .gif extension. Here are the steps:
- Access the DICOM file using the DicomImage class.
- Save the converted GIF image using the DicomImage.Save(string, ImageOptionsBase) method.
Here’s a code sample for converting DICOM to GIF in C#:
C# DICOM to PNG Conversion
The process for converting DICOM to PNG is similar to that of converting to JPEG. Simply access the DICOM file using the DicomImage class and save it with the .png extension. Here’s a code sample for converting DICOM to PNG in C#:
Export DICOM to BMP in C#
To convert DICOM to BMP, follow the same steps as before to access the DICOM file using the DicomImage class. Once accessed, use the DicomImage.Save(string, ImageBaseOptions) method to save the DICOM as BMP. Here’s a code sample for this conversion:
Conclusion
In this article, you have learned how to convert DICOM images to PNG, JPG, BMP, and GIF formats using C#. You can seamlessly integrate the provided code samples into your applications to perform efficient DICOM conversions.
C# DICOM to Image Converter - Learn More
Explore more about working with images using the Aspose.Imaging for .NET API.
See Also
Info: You may find the Aspose Text to GIF web app interesting.