Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 23, 2021 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/a380d58f38d7de36e53211bba1910a95 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/a380d58f38d7de36e53211bba1910a95 to your computer and use it in GitHub Desktop.
Convert DGN to JPEG, PNG, or TIFF Image with Java | Export DGN to Picture
// Load input DGN file using Image class
Image image = Image.load("template.dgn");
// Initialize an object of CadRasterizationOptions
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);
// Create an instance of JpegOptions
JpegOptions options = new JpegOptions();
// Set CadRasterizationOptions properties
options.setVectorRasterizationOptions(rasterizationOptions);
// Convert DGN to JPG image
image.save("output.jpg", options);
// Load input DGN file using Image class
Image image = Image.load("template.dgn");
// Initialize an object of CadRasterizationOptions
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);
// Create an instance of PngOptions
PngOptions options = new PngOptions();
// Set CadRasterizationOptions properties
options.setVectorRasterizationOptions(rasterizationOptions);
// Convert DGN to PNG image
image.save("output.png", options);
// Load input DGN file using Image class
Image image = Image.load("template.dgn");
// Initialize an object of CadRasterizationOptions
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);
// Create an instance of TiffOptions
TiffOptions options = new TiffOptions();
// Set CadRasterizationOptions properties
options.setVectorRasterizationOptions(rasterizationOptions);
// Convert DGN to TIFF image
image.save("output.tiff", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment