.NET を使用して TIFF を EPS に変換する

概要

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

C# 画像を EPS に変換する

これらの記事では、C# を使用して BMP、JPG、PNG などの他の形式から EPS に変換する方法について説明します。

C# TIFFからEPSへの変換

Aspose.Page TIFFからEPSへの変換品質を確認し、無料のオンラインの TIFF から EPS へのコンバーター を使用し、生成された EPS ファイルを EPS ビューアー で表示します。


Aspose.Page for .NET の TIFF から EPS へのコンバーターは、.NET プラットフォームでサポートされている任意の言語(C#、VB、J#)を使用して、TIFF 画像を Encapsulated PostScript (EPS) ファイルに変換できます。

手順:C# での TIFF から EPS へのコンバーター API コード

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

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

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

C# で TIFF 画像を EPS 形式に保存するための文字列の使用

次の C# コードスニペットでは、入力画像と出力 EPS ファイルが文字列で割り当てられています。

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2
 3// The path to the documents directory.
 4string dataDir = GetDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8
 9// Save TIFF image to EPS file
10PsDocument.SaveImageAsEps(dataDir + "input1.tiff", dataDir + "output1.eps", options);

C# で TIFF を EPS に保存するためのストリームの使用

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

1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save TIFF image to EPS file
7PsDocument.SaveImageAsEps(inputStream, outputStream, options);

C# で TIFF を EPS に保存するために Bimap オブジェクトと文字列を使用する

次の C# コードスニペットでは、入力画像に Bitmap オブジェクトが割り当てられ、出力 EPS ファイルに文字列が割り当てられています。

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2
 3// The path to the documents directory.
 4string dataDir = GetDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8// Create the bitmap object from image file
 9using(Bitmap tiff = new Bitmap(File.OpenRead(dataDir + "input1.tiff")))
10{
11	// Save TIFF image to EPS file
12	PsDocument.SaveImageAsEps(tiff, dataDir + "output1.eps", options);
13}

Linux、macOS、その他のWindows以外のオペレーティングシステムでは、 Aspose.Page.Drawing NuGetパッケージをご利用いただけます。このパッケージは、System.Drawingシステムライブラリではなく、Aspose.Drawingバックエンドを使用します。

そのため、System.Drawing名前空間ではなく、Aspose.Page.Drawing名前空間をインポートしてください。上記および以下のコードスニペットでは、System.Drawing.Bitmapではなく、Aspose.Page.Drawing.Bitmapが使用されます。GitHubのコード例には、必要な置換がすべて含まれています。

C# で TIFF を EPS に保存するために Bimap オブジェクトとストリームを使用する

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

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2
 3// The path to the documents directory.
 4string dataDir = GetDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8// Create the bitmap object from image file
 9using(Bitmap tiff = new Bitmap(File.OpenRead(dataDir + "input1.tiff")))
10{
11	// Create the output stream fo EPS file
12	using(Stream outputStream = File.OpenWrite(dataDir + "output1.eps"))
13	{
14		// Save TIFF image to EPS file
15		PsDocument.SaveImageAsEps(tiff, outputStream, options);
16	}
17}

TIFFからEPSへの変換については、 JavaC++をご覧ください。

TIFF to EPS Converterで、TIFFからEPSへの変換をオンラインで評価できます。複数のTIFF画像を一度にEPSファイルに変換し、数秒で結果をダウンロードできます。

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

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.