Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/cef3fa719da6be7847cd4bd20c411e76 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/cef3fa719da6be7847cd4bd20c411e76 to your computer and use it in GitHub Desktop.
Convert image to EPS with Java

Image to EPS Conversion Examples

These code snippets demonstrate how to convert images to EPS format using Aspose.Page for Java. The library enables seamless transformation of raster images into Encapsulated PostScript (EPS) files for further processing or printing.

Key Use Cases

  • Convert PNG, JPEG, TIFF, BMP images to EPS.
  • Automate image-to-EPS conversion for publishing workflows.

How to Run Examples

  1. Make sure Aspose.Page for Java library is referenced in your project.
  2. Copy the required code snippet into your project.
  3. Download a temporary license and set it up as described here or use a paid license.
  4. Run the example.

Restrictions

In evaluation mode, output EPS file is limited to 1Mb and contatins red evaluation warning. You must set up a valid temporary or paid license to use this feature.

Related Documentation

See the Convert Images to EPS section in the official documentation for more details.

Related Resources

Requirements

  • Java 8 or higher
  • Aspose.Page for Java library
Aspose.Page for Java – Convert Image to EPS Examples
// Convert BMP image to EPS from Bitmap object to file.
// Learn more: https://docs.aspose.com/page/java/convert/bmp-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = ImageIO.read(new java.io.File(getDataDir() + "input.bmp"));
// Save BMP bitmap to EPS file
PsDocument.saveImageAsEps(bmp, getOutputDir() + "output_bmp.eps", options);
} catch (IOException ex) {
}
// Convert BMP image to EPS from Bitmap object to stream.
// Learn more: https://docs.aspose.com/page/java/convert/bmp-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = javax.imageio.ImageIO.read(new java.io.File(getDataDir() + "input.bmp"));
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_bmp.eps")) {
// Save BMP bitmap to EPS file stream
PsDocument.saveImageAsEps(bmp, output, options);
}
} catch (IOException ex) {
}
// Convert BMP image to EPS using files paths.
// Learn more: https://docs.aspose.com/page/java/convert/bmp-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Save BMP image to EPS file
PsDocument.saveImageAsEps(getDataDir() + "input.bmp", getOutputDir() + "output_bmp.eps", options);
// Convert BMP image to EPS using streams.
// Learn more: https://docs.aspose.com/page/java/convert/bmp-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Create input stream from image
try (FileInputStream input = new FileInputStream(getDataDir() + "input.bmp")) {
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_bmp.eps")) {
// Save BMP image from input file stream to EPS file output stream
PsDocument.saveImageAsEps(input, output, options);
}
} catch (IOException ex) {
}
// Convert GIF image to EPS from Bitmap object to file.
// Learn more: https://docs.aspose.com/page/java/convert/gif-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = ImageIO.read(new java.io.File(getDataDir() + "input.gif"));
// Save GIF bitmap to EPS file
PsDocument.saveImageAsEps(bmp, getOutputDir() + "output_gif.eps", options);
} catch (IOException ex) {
}
// Convert GIF image to EPS from Bitmap object to stream.
// Learn more: https://docs.aspose.com/page/java/convert/gif-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = javax.imageio.ImageIO.read(new java.io.File(getDataDir() + "input.gif"));
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_gif.eps")) {
// Save GIF bitmap to EPS file stream
PsDocument.saveImageAsEps(bmp, output, options);
}
} catch (IOException ex) {
}
// Convert GIF image to EPS using files paths.
// Learn more: https://docs.aspose.com/page/java/convert/gif-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Save GIF image to EPS file
PsDocument.saveImageAsEps(getDataDir() + "input.gif", getOutputDir() + "output_gif.eps", options);
// Convert GIF image to EPS using streams.
// Learn more: https://docs.aspose.com/page/java/convert/gif-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Create input stream from image
try (FileInputStream input = new FileInputStream(getDataDir() + "input.gif")) {
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_gif.eps")) {
// Save GIF image from input file stream to EPS file output stream
PsDocument.saveImageAsEps(input, output, options);
}
} catch (IOException ex) {
}
// Convert JPEG image to EPS from Bitmap object to file.
// Learn more: https://docs.aspose.com/page/java/convert/jpg-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = ImageIO.read(new java.io.File(getDataDir() + "input.jpg"));
// Save JPEG bitmap to EPS file
PsDocument.saveImageAsEps(bmp, getOutputDir() + "output_jpg.eps", options);
} catch (IOException ex) {
}
// Convert JPEG image to EPS from Bitmap object to stream.
// Learn more: https://docs.aspose.com/page/java/convert/jpg-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = javax.imageio.ImageIO.read(new java.io.File(getDataDir() + "input.jpg"));
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_jpg.eps")) {
// Save JPEG bitmap to EPS file stream
PsDocument.saveImageAsEps(bmp, output, options);
}
} catch (IOException ex) {
}
// Convert JPEG image to EPS using files paths.
// Learn more: https://docs.aspose.com/page/java/convert/jpg-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Save JPEG image to EPS file
PsDocument.saveImageAsEps(getDataDir() + "input.jpg", getOutputDir() + "output_jpg.eps", options);
// Convert JPEG image to EPS using streams.
// Learn more: https://docs.aspose.com/page/java/convert/jpg-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Create input stream from image
try (FileInputStream input = new FileInputStream(getDataDir() + "input.jpg")) {
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_jpg.eps")) {
// Save JPEG image from input file stream to EPS file output stream
PsDocument.saveImageAsEps(input, output, options);
}
} catch (IOException ex) {
}
// Convert PNG image to EPS from Bitmap object to file.
// Learn more: https://docs.aspose.com/page/java/convert/png-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = ImageIO.read(new java.io.File(getDataDir() + "input.png"));
// Save PNG bitmap to EPS file
PsDocument.saveImageAsEps(bmp, getOutputDir() + "output_png.eps", options);
} catch (IOException ex) {
}
// Convert PNG image to EPS from Bitmap object to stream.
// Learn more: https://docs.aspose.com/page/java/convert/png-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
try {
BufferedImage bmp = javax.imageio.ImageIO.read(new java.io.File(getDataDir() + "input.png"));
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_png.eps")) {
// Save PNG bitmap to EPS file stream
PsDocument.saveImageAsEps(bmp, output, options);
}
} catch (IOException ex) {
}
// Convert PNG image to EPS using files paths.
// Learn more: https://docs.aspose.com/page/java/convert/png-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Save PNG image to EPS file
PsDocument.saveImageAsEps(getDataDir() + "input.png", getOutputDir() + "output_png.eps", options);
// Convert PNG image to EPS using streams.
// Learn more: https://docs.aspose.com/page/java/convert/png-to-eps/
// Create default options
PsSaveOptions options = new PsSaveOptions();
// Create input stream from image
try (FileInputStream input = new FileInputStream(getDataDir() + "input.png")) {
// Create output stream for EPS
try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_png.eps")) {
// Save PNG image from input file stream to EPS file output stream
PsDocument.saveImageAsEps(input, output, options);
}
} catch (IOException ex) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment