Convert DGN to JPEG, PNG, or TIFF Image in C#

DGN to JPG, PNG, TIFF

DGN files are two-dimensional or three-dimensional (2D/3D) drawings supported by construction CAD applications. In certain cases, you may need to convert a DGN file to an image for previewing it in different system environments. This article covers how to convert DGN to JPEG, PNG, or TIFF image with all the important details:

DGN to JPEG, PNG, or TIFF Image Converter – C# API Installation

Aspose.CAD for .NET API supports creating, editing, and manipulating DGN files and several other file formats. You can configure the API by downloading the DLL file from the New Releases, or using the following NuGet installation command:

PM> Install-Package Aspose.CAD

Convert DGN File to JPEG Image Programmatically with C#

You can convert a DGN file to a JPEG image with the following steps:

  1. Load input DGN file using the Image class.
  2. Initialize an object of CadRasterizationOptions class.
  3. Create an instance of JpegOptions class.
  4. Convert the DGN to a JPG image with the Save method.

The following code snippet shows how to convert a DGN file to a JPEG image programmatically using C#:

Convert DGN to PNG Image Programmatically using C#

You can convert a DGN file to a PNG image with the steps below:

  1. Load input DGN file with the Image class.
  2. Create an instance of CadRasterizationOptions and set image height & width.
  3. Create an instance of PngOptions and set VectorRasterizationOptions.
  4. Convert the DGN to a PNG Image using Image.Save method.

The code sample below explains how to convert a DGN file to a PNG image programmatically with C#:

DGN to TIFF Image Conversion Programmatically in C#

You can convert a DGN file to a TIFF image with the below steps:

  1. Load input DGN file using the Image class.
  2. Initialize an object of CadRasterizationOptions class.
  3. Create an instance of TiffOptions type.
  4. Set the VectorRasterizationOptions property.
  5. Convert the DGN to a TIFF image with the Save method.

The following code snippet shows how to convert a DGN file to a TIFF image programmatically in C#:

Get Free Temporary License

You can evaluate the API without any limitations by requesting a Free Temporary License.

Conclusion

In this article, you have learned how to convert a DGN file to different image formats like JPEG, PNG, or TIFF programmatically using C#. You can take a look at several other features of the API by visiting the Documentation. In case of any queries, please get in touch with us at the Free Support Forum.

See Also

Convert IGS IGES File to PDF Programmatically using C#

Convert STL to PDF or PNG Image Programmatically in C#