使用 Python 将 TIFF 转换为 EPS

本文介绍了如何使用 Python 将 TIFF 转换为 EPS 的不同方法。学习所有方法,找到最适合您的方法。

Python TIFF 转 EPS

您可以使用免费的在线 TIFF 转 EPS 转换器 检查 Aspose.Page TIFF 转 EPS 的质量并查看结果,然后使用我们的 EPS 查看器 查看生成的 EPS 文件。


步骤:Python 中的 TIFF 转 EPS 转换器 API 代码

请按照以下步骤执行 TIFF 转 EPS 转换:

  1. 创建一个 PsSaveOptions
  2. 使用 PsDocument 的静态方法 save_image_to_eps

save_image_to_eps 方法有四个修改,以便用户以最舒适的方式将 TIFF 图像保存为 EPS 文件。

在 Python 中使用字符串将 TIFF 保存为 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 TIFF image as EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.tiff", data_dir + "output1.eps", options)

使用 Python 中的流将 TIFF 保存为 EPS

以下 Python 代码片段通过流分配输入图像和输出 EPS 文件:

1# For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Python-.NET
2
3data_dir = Util.get_data_dir_working_with_image_conversion()
4
5# Create default options
6options = PsSaveOptions()
7
8# Save TIFF image as EPS file
9PsDocument.save_image_as_eps(inputStream, outputStream, options)

在 Python 中使用 Bitmap 对象和字符串将 TIFF 保存为 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
10tiff = aspose.pydrawing.Bitmap(open(dataDir + "input1.tiff")))
11
12# Save TIFF image to EPS file
13PsDocument.save_image_as_eps(tiff, dataDir + "output1.eps", options);

在 Python 中使用 Bitmap 对象和流将 TIFF 保存为 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
10tiff = aspose.pydrawing.Bitmap(open(dataDir + "input1.tiff")))
11
12# Save TIFF image to output stream
13PsDocument.save_image_as_eps(tiff, outputStream, options);

请参阅 .NETJava 中 TIFF 到 EPS 的转换。

在我们的 TIFF 到 EPS 转换器 上在线评估 TIFF 到 EPS 的转换效果。您可以一次将多个 TIFF 图像转换为 EPS 文件,并在几秒钟内下载结果。

您可以从 GitHub 下载示例和数据文件。

其他转换选项:

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.