You can read all the details at: Convert DWG/DXF CAD File to JPG, PNG, GIF Image with Java
Last active
December 23, 2021 07:03
-
-
Save aspose-com-gists/d6486d0e1068b73b822ae8651c6759f2 to your computer and use it in GitHub Desktop.
Convert DWG/DXF CAD File to JPG, PNG, GIF Image Programmatically using Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input CAD file | |
Image image = Image.load("Test.dwg"); | |
// Create an instance of CadRasterizationOptions | |
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); | |
// Set page width & height | |
rasterizationOptions.setPageWidth(1200); | |
rasterizationOptions.setPageHeight(1200); | |
// Create an instance of GifOptions for the resultant image | |
ImageOptionsBase options = new GifOptions(); | |
// Set rasterization options | |
options.setVectorRasterizationOptions(rasterizationOptions); | |
// Convert CAD DWG DXF file to GIFF image | |
image.save("output_image.giff" , options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input DWG file | |
Image image = Image.load("Test.dwg"); | |
// Create an instance of CadRasterizationOptions | |
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); | |
// Set page width & height | |
rasterizationOptions.setPageWidth(1200); | |
rasterizationOptions.setPageHeight(1200); | |
// Create an instance of JpegOptions for the resultant image | |
ImageOptionsBase options = new JpegOptions(); | |
// Set rasterization options | |
options.setVectorRasterizationOptions(rasterizationOptions); | |
// Convert CAD DWG DXF file to JPG image | |
image.save("output_image.jpg" , options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input DWG file | |
Image image = Image.load("Test.dwg"); | |
// Create an instance of CadRasterizationOptions | |
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); | |
// Set page width & height | |
rasterizationOptions.setPageWidth(1200); | |
rasterizationOptions.setPageHeight(1200); | |
// Create an instance of PngOptions for the resultant image | |
ImageOptionsBase options = new PngOptions(); | |
// Set rasterization options | |
options.setVectorRasterizationOptions(rasterizationOptions); | |
// Convert CAD DWG DXF file to PNG image | |
image.save("output_image.png" , options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment