Convert EMF to EPS using Python

This article explains how to convert EMF to EPS using Python in different ways. Learn all to find the one that suits you best.

Python EMF to EPS Conversion

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


Steps: EMF to EPS Converter API Code in Python

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

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

The save_image_to_eps method has four modifications to provide a user with the most comfortable way to save BMP image to EPS.

Using strings for saving EMF to EPS in Python

In the following Python 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-Python-.NET
 2
 3# The path to the documents directory.
 4data_dir = Util.get_data_dir_working_with_image_conversion()
 5
 6# Create default options
 7options = PsSaveOptions()
 8
 9# Save EMF image to EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.emf", data_dir + "output1.eps", options)

Using streams for saving EMF to EPS in Python

In the following Python 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-Python-.NET
2
3# Create default options
4options = PsSaveOptions()
5
6# Save EMF image to EPS file
7PsDocument.save_image_as_eps(inputStream, outputStream, options)

Using Bitmap object and string for saving EMF to EPS in Python

In the following Python code snippet input image is assigned by aspose.pydrawing.Bitmap 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-Python-.NET
 2
 3# The path to the documents directory.
 4data_dir = Util.get_data_dir_working_with_image_conversion()
 5
 6# Create default options
 7options = PsSaveOptions()
 8
 9# Create the Bitmap object from the image file
10emf = aspose.pydrawing.Bitmap(open(dataDir + "input1.emf")))
11
12# Save EMF image to EPS file
13PsDocument.save_image_as_eps(emf, dataDir + "output1.eps", options);

Using Bitmap object and stream for saving EMF to EPS in Python

In the following Python code snippet an input image is assigned by the aspose.pydrawing.Bitmap 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-Python-.NET
 2
 3# The path to the documents directory.
 4data_dir = Util.get_data_dir_working_with_image_conversion()
 5
 6# Create default options
 7options = PsSaveOptions()
 8
 9# Create the Bitmap object from the image file
10emf = aspose.pydrawing.Bitmap(open(dataDir + "input1.emf")))
11
12# Save EMF image to output stream
13PsDocument.save_image_as_eps(emf, outputStream, options);

See EMF to EPS conversion in .NET.

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

You can download examples and data files from GitHub.

Other conversion options:

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.