使用 .NET API 将 GIF 转换为 EPS
概述
本文讲解如何使用 C# 将 GIF 转换为 EPS 文件。内容涵盖以下主题:
- C# 将 GIF 转换为 EPS 文件
- C# 将 GIF 转换为 EPS 文件
- C# 将图像转换为 EPS 文件
- C# 将 EPS 文件转换为 GIF 文件
- C# 如何通过编程将 GIF 转换为 EPS 文件
- C# 将 GIF 另存为 EPS 文件
本文涵盖了如何使用 C# 将 JPG、TIFF、PNG 等其他格式的图像转换为 EPS 文件。
C# GIF 转 EPS
您可以通过免费在线 <a nofollow 工具检查 Aspose.Page GIF 转 EPS 的质量并查看结果href=“ https://products.aspose.app/page/conversion/gif-to-eps">GIF 到 EPS 转换器,然后使用我们的 EPS 查看器 查看生成的 EPS 文件
步骤:C# 格式的 GIF 转 EPS 转换器 API 代码
只需执行以下两个步骤即可完成 GIF 转 EPS 转换:
- 创建 PsSaveOptions 实例。
- 使用 PsDocument 的静态方法 SaveImageToEps。
SaveImageToEps 方法有四处修改,以便用户以最便捷的方式将 GIF 图像保存为 EPS 文件。
在 C# 中使用字符串将 GIF 保存为 EPS 文件
在以下 C# 代码片段中,输入图像和输出 EPS 文件均通过字符串赋值:
1// Convert GIF image to EPS using files paths.
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save GIF image to EPS file
7PsDocument.SaveImageAsEps(DataDir + "input.gif", OutputDir + "output_gif.eps", options);在 C# 中使用流将 GIF 保存为 EPS
以下 C# 代码片段通过流分配输入图像和输出 EPS 文件:
1// Convert GIF 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.gif", FileMode.Open))
8{
9 // Create output stream for EPS
10 using (FileStream output = new FileStream(OutputDir + "output_gif.eps", FileMode.Open))
11 {
12 // Save GIF image from input file stream to EPS file output stream
13 PsDocument.SaveImageAsEps(input, output, options);
14 }
15}在 C# 中使用 Bimap 对象和字符串将 GIF 保存为 EPS
以下 C# 代码片段中,输入图像由 Bitmap 对象赋值,输出 EPS 文件由字符串赋值:
1// Convert GIF 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.gif"))
7{
8 // Save GIF bitmap to EPS file
9 PsDocument.SaveImageAsEps(bmp, OutputDir + "output_gif.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 对象和流将 GIF 保存为 EPS
在以下 C# 代码片段中,输入图像由 Bitmap 对象分配,输出 EPS 文件由流分配:
1// Convert GIF 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.gif"))
7{
8 // Create output stream for EPS
9 using (FileStream output = new FileStream(OutputDir + "output_gif.eps", FileMode.Open))
10 {
11 // Save GIF bitmap to EPS file stream
12 PsDocument.SaveImageAsEps(bmp, output, options);
13 }
14}使用我们的 GIF 到 EPS 转换器 在线评估 GIF 到 EPS 的转换效果。您可以一次将多个 GIF 图像转换为 EPS 文件,并在几秒钟内下载结果。
您可以从 GitHub 下载示例和数据文件。