This quick tutorial explains how to convert DGN to JPG in Python. It encompasses all the relevant information you need to export DGN to JPG image in Python. Moreover, you can change different properties to customize DGN to JPG image rendering.
Steps to Export DGN to JPG in Python
- Configure Aspose.CAD for Python from the Repository Manager
- Load the source DGN drawing with the Image class
- Initiate an object of the CadRasterizationOptions class and set different properties
- Create an object of JpegOptions class
- Render the input DGN file to a JPG image using the save method
The preceding steps briefly outline an algorithm for converting DGN to JPEG using Python. You need to load the input DGN file and set custom properties based on your preference. Finally, write the generated image as a JPG, PNG, or other popular image format.
Code to Convert DGN to JPG in Python
This code snippet is a basic showcase example to render DGN to JPG in Python. However, you can modify several properties in the CadRasterizationOptions class, such as the layout, margins, borders, etc. Similarly, use the JpegOptions class to specify quality, compression type, and color palette based on your requirements.
In this article, you have understood the process of rendering a DGN file to JPG in Python. Besides, if you want to export DWG to an image, refer to the article Convert DWG to JPG in Python.