Enum TiffCompression
A TIFF compression scheme, by its code in the Compression tag.
public enum TiffCompression
Fields
AdobeDeflate = 32946Deflate under its older private code (32946); read only, written as Deflate.
CcittGroup3 = 3CCITT Group 3 fax, T.4 (3); 1-bit images only.
CcittGroup4 = 4CCITT Group 4 fax, T.6 (4); 1-bit images only.
CcittRle = 2CCITT modified Huffman run lengths (2); read only.
CcittRleWord = 32771CCITT run lengths on 16-bit words (32771); read only.
Deflate = 8Deflate (8), the zlib format.
DngJpegXl = 52546JPEG XL under DNG 1.7's code (52546), for previews and other pages that are not camera RAW; read only.
Jpeg = 7JPEG as Adobe's TIFF Technical Note 2 describes it (7).
JpegXl = 50002JPEG XL (50002), each strip or tile a JPEG XL codestream or file; read only.
Lzma = 34925LZMA (34925), each strip or tile an xz stream of LZMA2, as libtiff writes; written at LzmaPreset.
Lzw = 5LZW (5).
None = 1No compression (1).
OldJpeg = 6Old-style JPEG from TIFF 6.0 (6); read only, best effort.
PackBits = 32773PackBits (32773).
SgiLog = 34676SGILog, LogL and LogLuv high dynamic range (34676); read only.
SgiLog24 = 34677SGILog24, LogLuv in 24 bits (34677); read only.
ThunderScan = 32809ThunderScan 4-bit gray (32809); read only.
Webp = 50001WebP (50001).
Zstd = 50000Zstandard (50000), libtiff's code; written at ZstdLevel.
Examples
// Each pixel type is written at its own depth: 16-bit color stays 16-bit. Deflate with the predictor is the default.
photo.Save("duck.tif");
// Tiles, LZW, BigTIFF, or the smallest exact form the pixels allow.
photo.Save("tiled.tif", new TiffWriterOptions { Compression = TiffCompression.Lzw, TileSize = 256, Layout = TiffLayout.Auto });
photo.Save("small.tif", new TiffWriterOptions { Reduce = true });
// JPEG inside TIFF: RGB is written as YCbCr 4:2:0 with the tables shared by every strip.
photo.Save("photo.tif", new TiffWriterOptions { Compression = TiffCompression.Jpeg, Quality = 90 });