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
- Configure your project by specifying the Aspose.Page JAR file from the Maven Repository
- Initialize output image format as PNG
- Initialize PsDocument class object with input EPS file
- Create an ImageDevice class object with needed image dimensions
- 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.