PSからTIFFへ
C++ 用 API ソリューションを介して PS を TIFF に変換します。
PS から TIFF へのコンバーター用 Aspose.Page は、C++ でサポートされている言語を使用して PostScript (PS) ファイルを TIFF 画像に変換できます。
ここに表示される API を使用して、独自のクロスプラットフォーム アプリケーションを作成したり、C++ プロジェクトに統合したりできます。
XPS を TIFF に変換するには:
Aspose.Page for C++ API は、機能が豊富で強力で使いやすい、C++ プラットフォーム用のドキュメント操作および変換 API です。
最新バージョンを直接ダウンロードできます。NuGet パッケージ マネージャーを開いて、Aspose.Page.Cpp を検索してインストールします。パッケージ マネージャー コンソールから次のコマンドを使用することもできます。
Package Manager Console Command
PM> Install-Package Aspose.Page.Cpp
C++ を使用して PS を TIFF に変換する手順
Aspose.Page を使用すると、開発者はわずか数行のコードで PS ファイルをロードして TIFF に変換することが簡単になります。
- Aspose.Page for C++ を使用して PS ファイルを読み込みます。
- ImageSaveOptions Class のオブジェクトを作成し、画像形式を ImageFormat::Tiff 。
- 定義されたオプションを使用して SaveAsImage を呼び出して画像のバイト配列を取得します。
- 画像バイトを出力ストリームに書き込むことで画像を保存します。
PS から TIFF C++ への変換
// The path to the documents directory. | |
System::String dataDir = RunExamples::GetDataDir_WorkingWithDocumentConversion(); | |
// Initialize PsDocument with the name of PostScript file. | |
System::SharedPtr<PsDocument> document = System::MakeObject<PsDocument>(dataDir + u"input.ps"); | |
// If you want to convert Postscript file despite of minor errors set this flag | |
bool suppressErrors = true; | |
//Initialize options object with necessary parameters. | |
System::SharedPtr<ImageSaveOptions> options = System::MakeObject<ImageSaveOptions>(); | |
//Set output image format. | |
options->set_ImageFormat(Aspose::Page::Drawing::Imaging::ImageFormat::Tiff); | |
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included. | |
options->set_AdditionalFontsFolders(System::MakeArray<System::String>({u"{FONT_FOLDER}"})); | |
// Save PS document as array of image bytes, one bytes array for one page. | |
System::ArrayPtr<System::ArrayPtr<uint8_t>> imagesBytes = document->SaveAsImage(options); | |
//Save images bytes arrays as image files. | |
int32_t i = 0; | |
for (System::ArrayPtr<uint8_t> imageBytes : imagesBytes) | |
{ | |
System::String imagePath = System::IO::Path::GetFullPath(dataDir + u"out_image" + System::Convert::ToString(i) + u"." + System::ObjectExt::ToString(options->get_ImageFormat()).ToLower()); | |
{ | |
System::SharedPtr<System::IO::FileStream> fs = System::MakeObject<System::IO::FileStream>(imagePath, System::IO::FileMode::Create, System::IO::FileAccess::Write); | |
// Clearing resources under 'using' statement | |
System::Details::DisposeGuard<1> __dispose_guard_0({ fs}); | |
// ------------------------------------------ | |
try | |
{ | |
fs->Write(imageBytes, 0, imageBytes->get_Length()); | |
} | |
catch(...) | |
{ | |
__dispose_guard_0.SetCurrentException(std::current_exception()); | |
} | |
} | |
i++; | |
} | |
//Review errors | |
if (suppressErrors) | |
{ | |
for (auto&& ex : System::IterateOver(options->get_Exceptions())) | |
{ | |
System::Console::WriteLine(ex->get_Message()); | |
} | |
} | |
PS から TIFF への変換 Web アプリケーション
PS を TIFF ライブ デモ Web サイトにアクセスして、今すぐご利用ください。
PS PS ファイル形式とは
PS 形式は、ページ記述言語 (PDL) 形式の 1 つです。ページにグラフィック情報とテキスト情報を含めることができます。そのため、ほとんどの画像編集プログラムでこの形式がサポートされていました。 Postscript ファイル自体は、プリンターに対する一種の命令です。そのページから何をどのように印刷するかに関する情報が含まれています。
TIFF TIFF ファイル形式とは
Tag Image File Format 形式は、写真家の間で普及している形式です。見たことのある花、昆虫、露のしずくなどの素晴らしいマクロ写真など、非常に高品質の画像を維持できます。 TIFF には、イメージ情報とラスター グラフィックスが格納されます。それだけ多くの情報を格納すると、この形式の画像はかなり重くなるため、スペースを節約する必要がある場合には TIFF は適していません。