Python を使って JPG を EPS に変換する

この記事では、Python を使用して JPG を EPS に変換する 方法を複数ご紹介します。ご自身に最適な方法を見つけてください。

Python による JPG から EPS への変換

Aspose.Page による JPG から EPS への変換品質を確認し、無料のオンライン ソフト JPG から EPS へのコンバーター で結果を確認できます。その後、EPS ビューアー で変換後の EPS ファイルを表示できます。


手順:Python での JPG から EPS への変換 API コード

JPG から EPS への変換を実行するには、次の 2 つの手順を実行する必要があります。

  1. PsSaveOptions のインスタンスを作成します。
  2. PsDocument の静的メソッド save_image_to_eps を使用します。

save_image_to_eps メソッドには、JPG 画像を EPS として保存するための最も簡単な方法を提供するために、4 つの変更が加えられています。

Python で JPG 画像を 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 JPEG image as EPS file
10PsDocument.save_image_as_eps(data_dir + "input1.jpg", data_dir + "output1.eps", options)

Python でストリームを使用して JPG を EPS に保存する

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

1# For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Python-.NET
2
3data_dir = Util.get_data_dir_working_with_image_conversion()
4
5# Create default options
6options = PsSaveOptions()
7
8# Save JPG image to EPS file
9PsDocument.save_image_as_eps(inputStream, outputStream, options)

Python で Bitmap オブジェクトと文字列を使用して JPG を 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
10jpg = aspose.pydrawing.Bitmap(open(dataDir + "input1.jpg")))
11
12# Save the JPG image as EPS file
13PsDocument.save_image_as_eps(jpg, dataDir + "output1.eps", options);

Python で Bitmap オブジェクトとストリームを使用して JPG を 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
10jpg = aspose.pydrawing.Bitmap(open(dataDir + "input1.jpg")))
11
12# Save JPG image to output stream
13PsDocument.save_image_as_eps(jpg, outputStream, options);

JPGからEPSへの変換については、 .NETJavaをご覧ください。

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

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

その他の変換オプション:

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.