DGN files are often used by construction CAD applications for the designs of different infrastructures like roads, bridges, buildings, etc. You can convert a DGN file to an image for different requirements. This article covers DGN to PNG, JPEG, or TIFF image conversion:
- DGN to JPEG, PNG, or TIFF Image Converter – Java API Installation
- Convert DGN File to JPEG Image Programmatically with Java
- Convert DGN to PNG Image Programmatically using Java
- DGN to TIFF Image Conversion Programmatically in Java
DGN to JPEG, PNG, or TIFF Image Converter – Java API Installation
Aspose.CAD for Java API supports working with DGN and different other file formats. You can install the API by downloading the JAR file from the Downloads section or with the below Maven configurations:
Repository
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
</repositories>
Dependency
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cad</artifactId>
<version>21.8</version>
</dependency>
</dependencies>
Convert DGN File to JPEG Image Programmatically with Java
You can convert a DGN file to a JPEG image with the below steps:
- Load input DGN file using Image class.
- Create an instance of CadRasterizationOptions type.
- Initialize an object of JpegOptions class.
- Convert DGN to JPG image.
The following code explains how can you convert a DGN file to a JPEG image programmatically using Java:
Convert DGN to PNG Image Programmatically using Java
You can convert a DGN file to a PNG image with the steps below:
- Load input DGN file with Image class.
- Create an instance of CadRasterizationOptions and set image height & width.
- Convert DGN to PNG Image.
The following code demonstrates how to convert a DGN file to a PNG image programmatically using Java:
DGN to TIFF Image Conversion Programmatically in Java
You can easily convert a DGN file to a TIFF image with following steps:
- Load input DGN file using Image class.
- Initialize an instance object of CadRasterizationOptions class.
- Specify an object of TiffOptions type.
- Convert DGN to TIFF format image.
The following code elaborates how to convert a DGN file to a TIFF image programmatically in Java:
Get Free Temporary License
You can request a Free Temporary License to test the API without any limitation.
Conclusion
In this article, you have explored how to convert a DGN file to a picture or image like PNG, JPEG, or TIFF programmatically with Java. Please visit the API Documentation to learn more features offered by the API. Moreover, please reach out to us at the Free Support Forum in case of any inquiries.