JavaScriptのTIFFを圧縮するコード

元の品質を維持しながら TIFF ファイルのサイズと内容を最適化する高性能Node.jsライブラリ

TIFF Optimization API を使用して Node.js で TIFF 処理ソフトウェアを開発します。この強力な Node.js ソリューションを使用すると、TIFF ファイルのサイズを簡単に最適化して縮小できます。TIFF の圧縮機能をオンラインで無料でテストしてください。

コード スニペットを表示

JavaScript の JavaScript TIFF ファイルを圧縮します

品質を損なうことなく、大きな TIFF ファイルを小さくします。不要な未使用のデータを削除します。コード内の TIFF ファイルのサイズを縮小します。 JavaScript ライブラリは、 TIFF コンテンツを最適化するための統合APIを開発者に提供します。

JavaScript Model.ProgLang を使用して、 TIFF ファイルのサイズを縮小します

JavaScript ライブラリはスタンドアロンソリューションであり、サードパーティのソフトウェアをインストールする必要はありません。

'Aspose.Words for Node.js via .NET' 使用すると、ロスレス圧縮と詳細なコンテンツの最適化が簡単になります。次の例は、JavaScript の JavaScript TIFF ファイルのコンテンツを最適化する方法を示しています。

TIFFファイルを圧縮するためのJavaScriptのコード例
最適化/圧縮したいファイルをアップロードする
コードを実行する
リストからターゲットフォーマットを選択します
npm install @aspose/words
コピー
const aw = require('@aspose/words');

var doc = new aw.Document()
var builder = new aw.DocumentBuilder(doc)

shape = builder.insertImage("Input.tiff")

var saveOptions = new aw.Saving.ImageSaveOptions(aw.SaveFormat.Tiff)
saveOptions.tiffCompression = aw.Saving.TiffCompression.Lzw
shape.getShapeRenderer().save("Output.tiff", saveOptions)
const aw = require('@aspose/words'); var doc = new aw.Document("Input.tiff"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // 画像圧縮用のライブラリを選択するのは開発者次第です。 const imageData = shape.getImageData().toStream(); // ... // 画像を圧縮し、形状に戻します。 shape.getImageData().setImage(compressedImageBuffer); } } var saveOptions = new aw.Saving.PdfSaveOptions() saveOptions.cacheBackgroundGraphics = true doc.save("Output.tiff", saveOptions) const aw = require('@aspose/words'); var doc = new aw.Document("Input.tiff"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // 画像圧縮用のライブラリを選択するのは開発者次第です。 const imageData = shape.getImageData().toStream(); // ... // 画像を圧縮し、形状に戻します。 shape.getImageData().setImage(compressedImageBuffer); } } doc.save("Output.tiff") const aw = require('@aspose/words'); var doc = new aw.Document("Input.tiff"); doc.cleanup(); var shapes = doc.getChildNodes(aw.NodeType.Shape, true) for (var shape of shapes) { if (shape.hasImage()) { // 画像圧縮用のライブラリを選択するのは開発者次第です。 const imageData = shape.getImageData().toStream(); // ... // 画像を圧縮し、形状に戻します。 shape.getImageData().setImage(compressedImageBuffer); } } var saveOptions = new aw.Saving.OoxmlSaveOptions() saveOptions.compressionLevel = aw.Saving.CompressionLevel.Maximum doc.save("Output.tiff", saveOptions) const aw = require('@aspose/words'); var doc = new aw.Document() var builder = new aw.DocumentBuilder(doc) shape = builder.insertImage("Input.tiff") var saveOptions = new aw.Saving.ImageSaveOptions(aw.SaveFormat.Tiff) saveOptions.tiffCompression = aw.Saving.TiffCompression.Lzw shape.getShapeRenderer().save("Output.tiff", saveOptions)
コードを実行する

JavaScript で TIFF を圧縮する方法

  1. Aspose.Words for Node.js via .NETインストールします。
  2. JavaScriptプロジェクトにライブラリ参照を追加(ライブラリをインポート)します。
  3. JavaScriptのソースTIFFファイルを開きます。
  4. 品質を損なうことなくTIFFを圧縮します。
  5. Document.cleanup()メソッドを呼び出します。結果のコードは、出力ファイル形式によって異なる場合があります。
  6. 圧縮された結果をTIFFファイルとして取得します。

TIFFファイルを最適化および圧縮するためのJavaScriptライブラリ

We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.

System Requirements

This package is compatible with Node.js 14.17.0 or higher.

その他のサポートされているファイル形式の最適化

他の多くのファイル形式でファイルを最適化できます。

5%

Aspose製品アップデートを購読する

メールボックスに直接配信される月刊ニュースレターとオファーを入手してください。

© Aspose Pty Ltd 2001-2025. 全著作権所有。