Convert IFC to JPG or PNG Image using Java

IFC to JPG PNG

IFC files are used to model different buildings for construction purposes. In certain situations, you might want to convert an IFC file to a JPG or PNG image to display the model on different operating systems. This article explains how to convert an IFC file to an image programmatically using Java.

IFC to JPG or PNG Image Converter – Java API Installation

Aspose.CAD for Java API supports converting IFC files to an image. Please configure the API by downloading the JAR file from the New Releases section or with the following 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 IFC File to JPG Image Programmatically using Java

You can convert an IFC file to a JPG image with the following steps:

  1. Firstly, load source IFC file with the Image class constructor.
  2. Initialize CadRasterizationOptions class object.
  3. Create an instance of JpegOptions type.
  4. Convert the IFC to JPG image with VectorRasterizationOptions.

The code snippet below shows how to convert an IFC file to a JPG image using Java:

Convert IFC to PNG Image with Java

You can convert an IFC file to a PNG image with the steps below:

  1. Load source IFC file with the Image class.
  2. Initialize an object of CadRasterizationOptions class.
  3. Instantiate PngOptions class object.
  4. Finally, convert IFC to PNG image using VectorRasterizationOptions.

The following code sample explains how to convert an IFC file to a PNG image with Java:

Get Free Temporary License

You can request a free temporary license and test the API without any evaluation limitation.

Conclusion

In conclusion, you have explored how to convert an IFC file to an image in JPG or PNG format with Java. Please visit the documentation section to learn the different other features of the API. Moreover, please feel free to write to us at the free support forum in case of any queries.

See Also

Convert DGN to JPEG, PNG, or TIFF Image with Java