使用 Python 将 BMP 转换为 EPS
Contents
[ Hide Show ]本文介绍了如何使用 Python 将 BMP 转换为 EPS 的不同方法。学习所有方法,找到最适合您的方法。
Python BMP 转 EPS
您可以使用免费的在线 BMP 转 EPS 转换器 检查 Aspose.Page BMP 转 EPS 的质量并查看结果,然后使用我们的 EPS 查看器 查看生成的 EPS 文件
执行 BMP 转 EPS 只需执行两个步骤:
- 创建一个 PsSaveOptions。
- 使用 PsDocument 的静态方法 save_image_to_eps。
save_image_to_eps 方法有四个修改,以便用户以最舒适的方式将 BMP 图像保存为 EPS 文件。
在 Python 中使用字符串将 BMP 图像保存为 EPS 文件
在以下 Python 代码片段中,输入图像和输出 EPS 文件均通过字符串赋值:
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)使用 Python 中的流将 BMP 格式保存为 EPS 格式
以下 Python 代码片段中,输入一张图片,输出一个 EPS 文件,并通过流进行赋值:
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)在 Python 中使用 Bitmap 对象和字符串将 BMP 格式保存为 EPS 格式
以下 Python 代码片段中,aspose.pydrawing.Bitmap 对象指定输入图像,字符串指定输出 EPS 文件:
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);在 Python 中使用 Bitmap 对象和流将 BMP 格式保存为 EPS 格式
以下 Python 代码片段中,aspose.pydrawing.Bitmap 对象指定输入图像,并通过流指定输出 EPS 文件:
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);在我们的 BMP 到 EPS 转换器 上在线评估 BMP 到 EPS 的转换效果。您可以一次将多个 BMP 图像转换为 EPS 文件,并在几秒钟内下载结果。
您可以从 GitHub 下载示例和数据文件。
其他转换选项: