Convert BMP to EPS using Python

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

Python BMP to EPS Conversion

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


Steps: BMP to EPS Converter API Code in Python

It is necessary to do just 2 steps to perform BMP 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 a BMP image to EPS.

Using strings for saving BMP 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 BMP image to EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.bmp", data_dir + "output1.eps", options)

Using streams for saving BMP to EPS in Python

In the following Python code snippet input an image and an 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 BMP image to EPS file
7PsDocument.save_image_as_eps(inputStream, outputStream, options)

Using Bitmap object and string for saving BMP 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 a 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
10bmp = aspose.pydrawing.Bitmap(open(dataDir + "input1.bmp")))
11
12# Save the BMP image to EPS file
13PsDocument.save_image_as_eps(bmp, dataDir + "output1.eps", options);

Using Bitmap object and stream for saving BMP 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 a 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
10bmp = aspose.pydrawing.Bitmap(open(dataDir + "input1.bmp")))
11
12# Save BMP image to output stream
13PsDocument.save_image_as_eps(bmp, outputStream, options);

See BMP to EPS conversion in .NET, Java.

Evaluate BMP to EPS conversion online on our BMP to EPS Converter. You can convert several BMP 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.