# OfficeTiffCodec

Dependency-free classic TIFF encoder for single-page RGBA images.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeTiffCodec.cs:65](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.cs#L65)

**Modifiers**

static

Dependency-free classic TIFF encoder for single-page RGBA images.

## Inheritance

- object
- OfficeTiffCodec

Filter members 

Show inherited

## Methods

`public static byte[] Encode(OfficeRasterImage image, OfficeTiffEncodeOptions? options = null)` [#](#method-encode-officeimo-drawing-officerasterimage-officeimo-drawing-officetiffencodeoptions)

[OfficeTiffCodec.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.cs#L71)

Encodes a single RGBA image as a little-endian baseline TIFF.

Parameters

**image OfficeIMO.Drawing.OfficeRasterImage required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? = null optional**

Returns

`byte[]`

EncodePages 2 overloads

`public static byte[] EncodePages(IReadOnlyList<OfficeRasterImage> pages, OfficeTiffEncodeOptions? options = null)` [#](#method-encodepages-collections-generic-ireadonlylist-officeimo-drawing-officerasterimage-officeimo-drawing-officetiffencodeoptions)

[OfficeTiffCodec.MultiPage.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.MultiPage.cs#L9)

Encodes one or more RGBA pages as a bounded classic TIFF IFD chain.

Parameters

**pages System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRasterImage> required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? = null optional**

Returns

`byte[]`

`public static byte[] EncodePages(IReadOnlyList<OfficeRasterImage> pages, OfficeTiffEncodeOptions? options, CancellationToken cancellationToken)` [#](#method-encodepages-collections-generic-ireadonlylist-officeimo-drawing-officerasterimage-officeimo-drawing-officetiffencodeoptions-threading-cancellationtoken)

[OfficeTiffCodec.MultiPage.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.MultiPage.cs#L13)

Encodes bounded TIFF pages while observing cancellation during planning, compression, and copying.

Parameters

**pages System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRasterImage> required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`byte[]`

EncodePagesTo 2 overloads

`public static void EncodePagesTo(IReadOnlyList<OfficeRasterImage> pages, Stream destination, OfficeTiffEncodeOptions? options = null)` [#](#method-encodepagesto-collections-generic-ireadonlylist-officeimo-drawing-officerasterimage-io-stream-officeimo-drawing-officetiffencodeoptions)

[OfficeTiffCodec.MultiPage.cs:171](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.MultiPage.cs#L171)

Encodes one or more RGBA pages to a caller-owned writable stream.

Parameters

**pages System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRasterImage> required**

**destination System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? = null optional**

`public static void EncodePagesTo(IReadOnlyList<OfficeRasterImage> pages, Stream destination, OfficeTiffEncodeOptions? options, CancellationToken cancellationToken)` [#](#method-encodepagesto-collections-generic-ireadonlylist-officeimo-drawing-officerasterimage-io-stream-officeimo-drawing-officetiffencodeoptions-threading-cancellationtoken)

[OfficeTiffCodec.MultiPage.cs:177](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.MultiPage.cs#L177)

Encodes TIFF pages to a writable stream while observing cancellation during encoding and writes.

Parameters

**pages System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficeRasterImage> required**

**destination System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? required**

**cancellationToken System.Threading.CancellationToken required**

EncodeTo 2 overloads

`public static void EncodeTo(OfficeRasterImage image, Stream destination, OfficeTiffEncodeOptions? options = null)` [#](#method-encodeto-officeimo-drawing-officerasterimage-io-stream-officeimo-drawing-officetiffencodeoptions)

[OfficeTiffCodec.Streaming.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.Streaming.cs#L15)

Encodes a single RGBA image directly to a caller-owned writable stream.

Parameters

**image OfficeIMO.Drawing.OfficeRasterImage required**

**destination System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? = null optional**

`public static void EncodeTo(OfficeRasterImage image, IBufferWriter<byte> destination, OfficeTiffEncodeOptions? options = null)` [#](#method-encodeto-officeimo-drawing-officerasterimage-buffers-ibufferwriter-system-byte-officeimo-drawing-officetiffencodeoptions)

[OfficeTiffCodec.Streaming.cs:91](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.Streaming.cs#L91)

Encodes a single RGBA image directly to a caller-owned buffer writer.

Parameters

**image OfficeIMO.Drawing.OfficeRasterImage required**

**destination System.Buffers.IBufferWriter<byte> required**

**options OfficeIMO.Drawing.OfficeTiffEncodeOptions? = null optional**

`public static bool IsTiff(byte[]? encodedBytes)` [#](#method-istiff-byte)

[OfficeTiffCodec.cs:65](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.cs#L65)

Returns whether the payload starts with a TIFF byte-order marker and magic value.

Parameters

**encodedBytes byte[]? required**

Returns

`bool`

`public static bool TryDecode(byte[]? encodedBytes, out OfficeRasterImage? image)` [#](#method-trydecode-byte-officeimo-drawing-officerasterimage)

[OfficeTiffCodec.Decode.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.Decode.cs#L12)

Attempts to decode classic grayscale, RGB, RGBA, or device-CMYK TIFF with unsigned 8/12/16-bit or finite floating 16/24/32/64-bit samples, or packed 1/4-bit grayscale and 1/4/8-bit palette TIFF using chunky or planar strips or tiles with uncompressed, LZW, PackBits, or Deflate payloads. Bilevel CCITT, baseline eight-bit, extended-sequential eight/twelve-bit and Huffman/arithmetic lossless two-through-sixteen-bit JPEG TIFF are supported, including bounded legacy compression-6 layouts. Floating samples are normalized device components; BigTIFF payloads remain caller-codec responsibilities.

Parameters

**encodedBytes byte[]? required**

**image OfficeIMO.Drawing.OfficeRasterImage? required**

Returns

`bool`

`public static bool TryDecodePage(byte[]? encodedBytes, int pageIndex, out OfficeRasterImage? image)` [#](#method-trydecodepage-byte-int32-officeimo-drawing-officerasterimage)

[OfficeTiffCodec.Decode.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.Decode.cs#L16)

Attempts to decode one zero-based page from a bounded classic TIFF container.

Parameters

**encodedBytes byte[]? required**

**pageIndex int required**

**image OfficeIMO.Drawing.OfficeRasterImage? required**

Returns

`bool`

`public static bool TryGetPageCount(byte[]? encodedBytes, out int pageCount)` [#](#method-trygetpagecount-byte-int32)

[OfficeTiffCodec.cs:116](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeTiffCodec.cs#L116)

Reads the number of top-level images from a bounded classic TIFF IFD chain.

Parameters

**encodedBytes byte[]? required**

**pageCount int required**

Returns

`bool`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:94123C9A322CB7A92C39A7380C8B8B292057A961E62453FA634DCE62C173934D -->
