How to Convert EPS to PNG Image using Java

This tutorial covers basic information about how to convert EPS to PNG image using Java. You can export EPS to PNG image in Java using simple API calls on any operating system like Linux, MS Windows and macOS. You can create PNG image with high fidelity as it can be helpful for previewing the Encapsulated PostScript (EPS) files without needing any specific tool or application.

Steps to Convert EPS to PNG Image using Java

  1. Configure your project by specifying the Aspose.Page JAR file from the Maven Repository
  2. Initialize output image format as PNG
  3. Initialize PsDocument class object with input EPS file
  4. Create an ImageDevice class object with needed image dimensions
  5. Save the generated PNG image to the disk

In order to generate PNG from EPS using Java, first we will specify the output format using ImageFormat enumeration. Using FileInputStream class, we will load the input EPS file and initialize an object of PsDocument class. Then we will use ImageDevice class with needed image dimensions and save the output PNG image to disk using Java.

Code to Convert EPS to PNG Image using Java

In the previous topic, we have learnt how to create HTML file using Java. Whereas, this topic about Java create PNG from EPS can be helpful for previewing the EPS files or generating thumbnails for displaying the contents.

 English