使用 Java API 解决方案将 GIF 转换为 EPS
Contents
[
Hide
Show
]概述
本文讲解如何使用 Java 将 GIF 转换为 EPS 文件。内容涵盖以下主题:
- Java 将 GIF 转换为 EPS 文件
- Java 将 GIF 转换为 EPS 文件
- Java 将图像转换为 EPS 文件
- Java 如何通过编程将 GIF 转换为 EPS 文件
- Java 将 GIF 另存为 EPS 文件
本文涵盖了如何使用 Java 将 JPG、PNG、BMP 等其他格式的图像转换为 EPS 文件。
Java GIF 转 EPS
您可以使用免费的在线 GIF 转 EPS 转换器 检查 Aspose.Page GIF 转 EPS 的质量并查看结果,然后使用我们的 EPS 查看器 查看生成的 EPS 文件
只需执行以下两个步骤即可将 GIF 转换为 EPS:
- 创建 PsSaveOptions 实例。
- 使用 PsDocument 的静态方法 saveImageToEps。 saveImageToEps 方法有四种修改方式,以便用户以最便捷的方式将 GIF 图像保存为 EPS 文件。
使用字符串在 Java 中将 GIF 保存为 EPS
在以下 Java 代码片段中,输入图像和输出 EPS 文件通过字符串赋值:
1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
2
3// The path to the documents directory.
4String dataDir = getDataDir();
5
6// Create default options
7PsSaveOptions options = new PsSaveOptions();
8
9// Save GIF image to EPS file
10PsDocument.saveImageAsEps(dataDir + "input1.gif", dataDir + "output1.eps", options);
使用 Java 流将 GIF 保存为 EPS
以下 Java 代码片段通过流分配输入图像和输出 EPS 文件:
1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save GIF image to EPS file
7PsDocument.saveImageAsEps(inputStream, outputStream, options);
使用 BufferedImage 对象和字符串在 Java 中将 GIF 保存为 EPS
在以下 Java 代码片段中,输入图像由 BufferedImage 对象赋值,输出 EPS 文件由字符串赋值:
1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
2
3// The path to the documents directory.
4String dataDir = getDataDir();
5
6// Create default options
7PsSaveOptions options = new PsSaveOptions();
8
9// Create the BufferedImage object from the image file
10BufferedImage gif = ImageIO.read(new FileInputStream(dataDir + "input1.gif")))
11
12// Save GIF image to EPS file
13PsDocument.saveImageAsEps(gif, dataDir + "output1.eps", options);
使用 BufferedImage 对象和流在 Java 中将 GIF 保存为 EPS
在以下 Java 代码片段中,输入图像由 BufferedImage 对象赋值,输出 EPS 文件由流赋值:
1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
2
3// The path to the documents directory.
4String dataDir = getDataDir();
5
6// Create default options
7PsSaveOptions options = new PsSaveOptions();
8
9// Create the BufferedImage object from the image file
10BufferedImage gif = ImageIO.read(new FileInputStream(dataDir + "input1.gif")))
11
12// Create the output stream for EPS file
13OutputStream outputStream = new FileOutputStream(dataDir + "output1.eps"))
14
15// Save GIF image to EPS file
16PsDocument.saveImageAsEps(gif, outputStream, options);
查看 .NET 中 GIF 到 EPS 的转换。
在我们的 GIF 到 EPS 转换器 上在线评估 GIF 到 EPS 的转换效果。您可以一次将多个 GIF 图像转换为 EPS 文件,并在几秒钟内下载结果。
您可以从 GitHub 下载示例和数据文件。