使用 Python 将 EMF 转换为 EPS
Contents
[
Hide
Show
]本文介绍了如何使用 Python 将 EMF 转换为 EPS 的不同方法。学习所有方法,找到最适合您的方法。
Python EMF 转 EPS
您可以使用免费的在线 EMF 转 EPS 转换器 检查 Aspose.Page EMF 转 EPS 的质量并查看结果,然后使用我们的 EPS 查看器 查看生成的 EPS 文件
只需执行两个步骤即可完成 EMF 转 EPS 转换:
- 创建一个 PsSaveOptions。
- 使用 PsDocument 的静态方法 save_image_to_eps。
save_image_to_eps 方法有四个修改,以便用户以最舒适的方式将 BMP 图像保存为 EPS 文件。
在 Python 中使用字符串将 EMF 保存为 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 EMF image to EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.emf", data_dir + "output1.eps", options)
使用 Python 中的流将 EMF 保存为 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 EMF image to EPS file
7PsDocument.save_image_as_eps(inputStream, outputStream, options)
在 Python 中使用 Bitmap 对象和字符串将 EMF 保存为 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
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);
使用 Bitmap 对象和流在 Python 中将 EMF 保存为 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
10emf = aspose.pydrawing.Bitmap(open(dataDir + "input1.emf")))
11
12# Save EMF image to output stream
13PsDocument.save_image_as_eps(emf, outputStream, options);
查看 .NET 中 EMF 到 EPS 的转换。
在我们的 EMF 到 EPS 转换器 上在线评估 EMF 到 EPS 的转换效果。您可以一次将多个 EMF 图像转换为 EPS 文件,并在几秒钟内下载结果。
您可以从 GitHub 下载示例和数据文件。
其他转换选项: