How to Convert DWG to JPG using Java

This short tutorial provides details on how to convert DWG to JPG using Java. You can export DWG to JPG using Java by setting different properties like the height and width of image, background color, etc. and then create the output image file. You can also save the output to stream as well that you can further use in your application.

Steps to Convert DWG to JPG using Java

  1. Configure your application by adding the Aspose.CAD library from the Maven Repository
  2. Load the input DWG file with the Image class
  3. Create an instance of CadRasterizationOptions class
  4. Save the output JPG file

In this step-by-step tutorial to generate JPG from DWG in Java, firstly we load the input DWG file using the Image class object and then specify different properties for the rasterization options including image dimensions. Resultantly, the output JPG file is created by following all these simple steps.

Code to Convert DWG to JPG using Java

In the above code, the Image class object is used to load the source DWG file which can be used to save it as JPG image with desired background color and picture height or width. Likewise, you can render the output as a PNG image as well by initializing PngOptions class object and changing the extension for the output file name.

In addition to this feature to create JPG from DWG in Java you can export different type of files like explained in the article on how to convert OTG to PDF in Java. Please note that you do not need to install any other third-party tool or software for working with all these features.

 English