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// Convert BMP image to EPS using files paths.
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save BMP image to EPS file
7PsDocument.saveImageAsEps(getDataDir() + "input.bmp", getOutputDir() + "output_bmp.eps", options);

Javaでストリームを使用してBMPをEPSファイルに保存する

以下のJavaコードスニペットでは、入力画像と出力EPSファイルがストリームによって割り当てられています。

 1// Convert BMP image to EPS using streams.
 2
 3// Create default options
 4PsSaveOptions options = new PsSaveOptions();
 5
 6// Create input stream from image
 7try (FileInputStream input = new FileInputStream(getDataDir() + "input.bmp")) {
 8    // Create output stream for EPS
 9    try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_bmp.eps")) {
10        // Save BMP image from input file stream to EPS file output stream
11        PsDocument.saveImageAsEps(input, output, options);
12    }
13} catch (IOException ex) {
14}

JavaでBufferedImageオブジェクトと文字列を使用してBMPをEPSファイルに保存する

以下のJavaコードスニペットでは、入力画像はBufferedImageオブジェクトによって割り当てられ、出力EPSファイルは文字列によって割り当てられています。

 1// Convert BMP image to EPS from Bitmap object to file.
 2
 3// Create default options
 4PsSaveOptions options = new PsSaveOptions();
 5
 6try {
 7	BufferedImage bmp = ImageIO.read(new java.io.File(getDataDir() + "input.bmp"));
 8    // Save BMP bitmap to EPS file
 9    PsDocument.saveImageAsEps(bmp, getOutputDir() + "output_bmp.eps", options);
10} catch (IOException ex) {
11}

JavaでBufferedImageオブジェクトとストリームを使用してBMPをEPSファイルに保存する

以下のJavaコードスニペットでは、入力画像はBufferedImageオブジェクトによって割り当てられ、出力EPSファイルはストリームによって割り当てられます。

 1// Convert BMP image to EPS from Bitmap object to stream.
 2
 3// Create default options
 4PsSaveOptions options = new PsSaveOptions();
 5
 6try {
 7	BufferedImage bmp = javax.imageio.ImageIO.read(new java.io.File(getDataDir() + "input.bmp"));
 8    // Create output stream for EPS
 9    try (FileOutputStream output = new FileOutputStream(getOutputDir() + "output_bmp.eps")) {
10        // Save BMP bitmap to EPS file stream
11        PsDocument.saveImageAsEps(bmp, output, options);
12    }
13} catch (IOException ex) {
14}

.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.