Convert GIF to EPS using Java API Solution

Overview

This article explains how to convert GIF to EPS using Java. It covers the following topics.

Java Image to EPS

The Image to EPS conversion using Java from other formats like JPG, PNG, BMP are covered in these articles.

Java GIF to EPS Conversion

You can check the quality of Aspose.Page GIF to EPS conversion and view the results via free online GIF to EPS Converter and than view the resulting EPS file with our EPS Viewer


Aspose.Page for Java GIF to EPS converter allows to convert GIF image to Encapsulated PostScript (EPS) file on any OS for which Java Virtual Machine exists.
Steps: GIF to EPS Converter API Code in Java

It is necessary to do just 2 steps in order to perform GIF to EPS conversion:

  1. Create an instance of PsSaveOptions.
  2. Use static method saveImageToEps of PsDocument.

saveImageToEps method has four modifications to provide a user with the most comfortable way to save GIF image to EPS.

Using strings for saving GIF to EPS in Java

In the following Java code snippet the input image and the output EPS file are assigned by strings:

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
 2
 3// The path to the documents directory.
 4String dataDir = getDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8
 9// Save GIF image to EPS file
10PsDocument.saveImageAsEps(dataDir + "input1.gif", dataDir + "output1.eps", options);

Using streams for saving GIF to EPS in Java

In the following Java code snippet input image and output EPS file are assigned by streams:

1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save GIF image to EPS file
7PsDocument.saveImageAsEps(inputStream, outputStream, options);

Using BufferedImage object and string for saving GIF to EPS in Java

In the following Java code snippet input image is assigned by BufferedImage object and the output EPS file is assigned by string:

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
 2
 3// The path to the documents directory.
 4String dataDir = getDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8
 9// Create the BufferedImage object from the image file
10BufferedImage gif = ImageIO.read(new FileInputStream(dataDir + "input1.gif")))
11
12// Save GIF image to EPS file
13PsDocument.saveImageAsEps(gif, dataDir + "output1.eps", options);

Using BufferedImage object and stream for saving GIF to EPS in Java

In the following Java code snippet input image is assigned by BufferedImage object and the output EPS file is assigned by stream:

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
 2
 3// The path to the documents directory.
 4String dataDir = getDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8
 9// Create the BufferedImage object from the image file
10BufferedImage gif = ImageIO.read(new FileInputStream(dataDir + "input1.gif")))
11
12// Create the output stream for EPS file
13OutputStream outputStream = new FileOutputStream(dataDir + "output1.eps"))
14
15// Save GIF image to EPS file
16PsDocument.saveImageAsEps(gif, outputStream, options);

See GIF to EPS conversion in .NET and C++.

Evaluate GIF to EPS conversion online on our GIF to EPS Converter. You can convert several GIF image to EPS files at once and dowload results in a few seconds.

You can download examples and data files from GitHub.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.