Java APIソリューションを使用したBMPからEPSへの変換

概要

この記事では、Java を使用して BMP を EPS に変換する方法 について説明します。以下のトピックを取り上げます。

Java Image to EPS

Java を使って JPG、GIF、PNG などの他の形式から EPS に変換する方法については、以下の記事で解説しています。

Java BMPからEPSへの変換

Aspose.PageのBMPからEPSへの変換品質を確認し、無料のオンラインBMP to EPS Converterで結果を確認できます。その後、EPS Viewerで変換後のEPSファイルを表示できます。


Aspose.Page for Java の BMP から EPS へのコンバーターを使用すると、Java 仮想マシンが動作するあらゆる OS で、BMP 画像を Encapsulated PostScript (EPS) ファイルに変換できます。
手順:Java での BMP から EPS へのコンバーター API コード

BMP から EPS への変換は、以下の 2 つの手順で実行できます。

  1. PsSaveOptions のインスタンスを作成します。
  2. PsDocument の静的メソッドを使用します。 saveImageToEps メソッドには、BMP 画像を EPS に保存するための最も快適な方法を提供するために、4 つの変更点があります。

Java で文字列を使用して BMP 画像を 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 BMP image to EPS file
10PsDocument.saveImageAsEps(dataDir + "input1.bmp", dataDir + "output1.eps", options);

Javaでストリームを使用してBMPを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 BMP image to EPS file
7PsDocument.saveImageAsEps(inputStream, outputStream, options);

JavaでBufferedImageオブジェクトと文字列を使用してBMPを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 bmp = ImageIO.read(new FileInputStream(dataDir + "input1.bmp")))
11
12// Save BMP image to EPS file
13PsDocument.saveImageAsEps(bmp, dataDir + "output1.eps", options);

JavaでBufferedImageオブジェクトとストリームを使用してBMPを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 bmp = ImageIO.read(new FileInputStream(dataDir + "input1.bmp")))
11
12// Create the output stream for EPS file
13OutputStream outputStream = new FileOutputStream(dataDir + "output1.eps"))
14
15// Save BMP image to EPS file
16PsDocument.saveImageAsEps(bmp, outputStream, options);

.NET での BMP から EPS への変換をご覧ください。

BMP to EPS Converter で、BMP から EPS へのオンライン変換をお試しください。複数の BMP 画像を一度に EPS ファイルに変換し、数秒でダウンロードできます。

サンプルファイルとデータファイルは GitHub からダウンロードできます。

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.