Python を使って PNG を EPS に変換する
この記事では、Python を使用して PNG から EPS に変換する 方法を複数ご紹介します。ご自身に最適な方法を見つけてください。
Python による PNG から EPS への変換
Aspose.Page の PNG から EPS への変換品質を確認し、無料のオンライン ソフト PNG から EPS へのコンバーター で結果を確認できます。その後、EPS ビューアー で変換後の EPS ファイルを表示できます。
It is necessary to take just 2 steps in order to perform PNG to EPS conversion:
- Create an instance of PsSaveOptions.
- Use static method save_image_to_eps of PsDocument. 606 / 5,000 手順:Python での PNG から EPS への変換 API コード
PNG から EPS への変換を実行するには、次の 2 つの手順を実行する必要があります。
- PsSaveOptions のインスタンスを作成します。
- PsDocument の静的メソッド save_image_to_eps を使用します。
save_image_to_eps メソッドには、PNG 画像を EPS 形式に保存するための最も簡単な方法を提供するために、4 つの変更が加えられています。
Python で文字列を使用して PNG 画像を 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 the PNG image as EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.png", data_dir + "output1.eps", options)
Python でストリームを使用して PNG を 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 the PNG image as EPS file
7PsDocument.save_image_as_eps(inputStream, outputStream, options)
Python で Bitmap オブジェクトと文字列を使用して PNG を 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
10png = aspose.pydrawing.Bitmap(open(dataDir + "input1.png")))
11
12# Save the PNG image to EPS file
13PsDocument.save_image_as_eps(png, dataDir + "output1.eps", options);
Python で Bitmap オブジェクトとストリームを使用して PNG を 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
10png = aspose.pydrawing.Bitmap(open(dataDir + "input1.png")))
11
12# Save PNG image to output stream
13PsDocument.save_image_as_eps(png, outputStream, options);
PNG to EPS ConverterでPNGからEPSへの変換をオンラインで評価できます。複数のPNG画像を一度にEPSファイルに変換し、数秒で結果をダウンロードできます。
サンプルファイルとデータファイルは GitHubからダウンロードできます。
その他の変換オプション: