使用 .NET 将 TIFF 转换为 EPS
概述
本文讲解如何使用 C# 将 TIFF 转换为 EPS。内容涵盖以下主题:
- C# TIFF 转 EPS
- C# 将 TIFF 转换为 EPS
- C# 将图像转换为 EPS
- C# 将 EPS 转换为 TIFF
- C# 如何通过编程将 TIFF 转换为 EPS
- C# 将 TIFF 另存为 EPS
本文涵盖了如何使用 C# 将 BMP、JPG、PNG 等其他格式的图像转换为 EPS。
C# TIFF 转 EPS
您可以通过免费在线检查 Aspose.Page TIFF 转 EPS 的质量并查看结果 TIFF 到 EPS 转换器,然后使用我们的 EPS 查看器 查看生成的 EPS 文件
步骤:C# 语言 TIFF 转 EPS 转换器 API 代码
只需执行以下两个步骤即可完成 TIFF 转 EPS 转换:
- 创建 PsSaveOptions 实例。
- 使用 PsDocument 的静态方法 SaveImageToEps。
SaveImageToEps 方法有四处修改,以便用户以最便捷的方式将 TIFF 图像保存为 EPS 文件。
在 C# 中使用字符串将 TIFF 保存为 EPS 文件
在以下 C# 代码片段中,输入图像和输出 EPS 文件通过字符串赋值:
1// Convert TIFF image to EPS using files paths.
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save TIFF image to EPS file
7PsDocument.SaveImageAsEps(DataDir + "input.tiff", OutputDir + "output_tiff.eps", options);在 C# 中使用流将 TIFF 格式保存为 EPS 格式
以下 C# 代码片段通过流指定输入图像和输出 EPS 文件:
1// Convert TIFF image to EPS using streams.
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Create input stream from image
7using (FileStream input = new FileStream(DataDir + "input.tiff", FileMode.Open))
8{
9 // Create output stream for EPS
10 using (FileStream output = new FileStream(OutputDir + "output_tiff.eps", FileMode.Open))
11 {
12 // Save TIFF image from input file stream to EPS file output stream
13 PsDocument.SaveImageAsEps(input, output, options);
14 }
15}在 C# 中使用 Bimap 对象和字符串将 TIFF 保存为 EPS
以下 C# 代码片段中,输入图像由 Bitmap 对象赋值,输出 EPS 文件由字符串赋值:
1// Convert TIFF image to EPS from Bitmap object to file.
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6using (Bitmap bmp = new Bitmap(DataDir + "input.tiff"))
7{
8 // Save TIFF bitmap to EPS file
9 PsDocument.SaveImageAsEps(bmp, OutputDir + "output_tiff.eps", options);
10}对于 Linux、MacOS 和其他非 Windows 操作系统,我们建议使用我们的 Aspose.Page.Drawing Nuget 包。它使用 Aspose.Drawing 后端,而不是 System.Drawing 系统库。
因此,请导入 Aspose.Page.Drawing 命名空间,而不是 System.Drawing 命名空间。在上面和下面的代码片段中,将使用 Aspose.Page.Drawing.Bitmap 代替 System.Drawing.Bitmap。我们在 GitHub 上的代码示例包含所有必要的替换。
在 C# 中使用 Bimap 对象和流将 TIFF 保存为 EPS
在以下 C# 代码片段中,输入图像由 Bitmap 对象赋值,输出 EPS 文件由流赋值:
1// Convert TIFF image to EPS from Bitmap object to stream.
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6using (Bitmap bmp = new Bitmap(DataDir + "input.tiff"))
7{
8 // Create output stream for EPS
9 using (FileStream output = new FileStream(OutputDir + "output_tiff.eps", FileMode.Open))
10 {
11 // Save TIFF bitmap to EPS file stream
12 PsDocument.SaveImageAsEps(bmp, output, options);
13 }
14}在我们的 TIFF 到 EPS 转换器 上在线评估 TIFF 到 EPS 的转换效果。您可以一次将多个 TIFF 图像转换为 EPS 文件,并在几秒钟内下载结果。
您可以从 GitHub 下载示例和数据文件。