Python を使って BMP を EPS に変換
この記事では、Python を使用して BMP を EPS に変換する 方法を様々な方法で説明します。すべての方法を学習して、自分に最適な方法を見つけてください。
Python による BMP から EPS への変換
Aspose.Page による BMP から EPS への変換品質を確認し、無料のオンライン BMP から EPS へのコンバーター で結果を確認できます。その後、EPS ビューアー で変換後の EPS ファイルを表示できます。
BMP から EPS への変換は、以下の 2 つの手順で実行できます。
- PsSaveOptions のインスタンスを作成します。
- PsDocument の静的メソッド save_image_to_eps を使用します。
save_image_to_eps メソッドには、BMP 画像を EPS 形式に保存するための最も簡単な方法を提供するために、4 つの変更が加えられています。
Python で文字列を使用して BMP 画像を EPS 形式に保存する
次の Python コードスニペットでは、入力画像と出力 EPS ファイルが文字列で割り当てられています。
1# For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Python-.NET
2
3# The path to the documents directory.
4data_dir = Util.get_data_dir_working_with_image_conversion()
5
6# Create default options
7options = PsSaveOptions()
8
9# Save BMP image to EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.bmp", data_dir + "output1.eps", options)
Python でストリームを使用して BMP を EPS に保存する
次の Python コードスニペットでは、入力画像と出力 EPS ファイルがストリームによって割り当てられています。
1# For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Python-.NET
2
3# Create default options
4options = PsSaveOptions()
5
6# Save BMP image to EPS file
7PsDocument.save_image_as_eps(inputStream, outputStream, options)
Python で Bitmap オブジェクトと文字列を使用して BMP を EPS に保存する
次の Python コードスニペットでは、入力画像は aspose.pydrawing.Bitmap オブジェクトによって割り当てられ、出力 EPS ファイルは文字列によって割り当てられています。
1# For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Python-.NET
2
3# The path to the documents directory.
4data_dir = Util.get_data_dir_working_with_image_conversion()
5
6# Create default options
7options = PsSaveOptions()
8
9# Create the Bitmap object from the image file
10bmp = aspose.pydrawing.Bitmap(open(dataDir + "input1.bmp")))
11
12# Save the BMP image to EPS file
13PsDocument.save_image_as_eps(bmp, dataDir + "output1.eps", options);
Python で Bitmap オブジェクトとストリームを使用して BMP を EPS に保存する
次の Python コードスニペットでは、入力画像は aspose.pydrawing.Bitmap オブジェクトによって割り当てられ、出力 EPS ファイルはストリームによって割り当てられます。
1# For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Python-.NET
2
3# The path to the documents directory.
4data_dir = Util.get_data_dir_working_with_image_conversion()
5
6# Create default options
7options = PsSaveOptions()
8
9# Create the Bitmap object from the image file
10bmp = aspose.pydrawing.Bitmap(open(dataDir + "input1.bmp")))
11
12# Save BMP image to output stream
13PsDocument.save_image_as_eps(bmp, outputStream, options);
BMP to EPS Converterで、BMPからEPSへのオンライン変換をお試しください。複数のBMP画像を一度にEPSファイルに変換し、数秒でダウンロードできます。
サンプルファイルとデータファイルは GitHubからダウンロードできます。
その他の変換オプション: