# OfficeRasterImageDecoder

Shared dependency-free decoder for raster image bytes that can be painted by OfficeRasterCanvas.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeRasterImageDecoder.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.cs#L23)

**Modifiers**

static

Shared dependency-free decoder for raster image bytes that can be painted by [OfficeRasterCanvas](/api/core/officeimo-drawing-officerastercanvas/).

## Inheritance

- object
- OfficeRasterImageDecoder

## Remarks

HEIC composition converts supported ICC/SDR nclx source colors through the licensed system-codec path. Other decoding produces channel values, not a color-managed sRGB conversion. Embedded ICC profiles and PNG gamma/chromaticity metadata are validated as container metadata but are not applied to pixels. Normalize other color-managed source images before decoding when matching a managed display or print pipeline is required.

Filter members 

Show inherited

## Methods

Decode 4 overloads

`public static OfficeRasterImage Decode(byte[] bytes, OfficeRasterDecodeOptions? options = null)` [#](#method-decode-byte-officeimo-drawing-officerasterdecodeoptions)

[OfficeRasterImageDecoder.Convenience.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L5)

Decodes the requested static frame, throwing InvalidDataException for unsupported input, rejection, or limits.

Parameters

**bytes byte[] required**

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

Returns

`OfficeRasterImage`

`public static OfficeRasterImage Decode(byte[] bytes, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info)` [#](#method-decode-byte-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterdecodeinfo)

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

Decodes the requested static frame and returns source, loss, and orientation evidence.

Parameters

**bytes byte[] required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

Returns

`OfficeRasterImage`

`public static OfficeRasterImage Decode(Stream stream, OfficeRasterDecodeOptions? options = null)` [#](#method-decode-io-stream-officeimo-drawing-officerasterdecodeoptions)

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

Decodes a static frame from a stream, leaving it open and restoring its position when seekable.

Parameters

**stream System.IO.Stream required**

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

Returns

`OfficeRasterImage`

`public static OfficeRasterImage Decode(Stream stream, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info)` [#](#method-decode-io-stream-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterdecodeinfo)

[OfficeRasterImageDecoder.Convenience.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L19)

Decodes a static frame from a stream with source, loss, and orientation evidence.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

Returns

`OfficeRasterImage`

DecodeFrames 4 overloads

`public static OfficeRasterFrames DecodeFrames(byte[] bytes, OfficeRasterDecodeOptions? options = null, int maximumFrames = 256)` [#](#method-decodeframes-byte-officeimo-drawing-officerasterdecodeoptions-int32)

[OfficeRasterImageDecoder.Convenience.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L24)

Decodes every rendered frame or independent page within aggregate limits; cancellation propagates.

Parameters

**bytes byte[] required**

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

**maximumFrames int = 256 optional**

Returns

`OfficeRasterFrames`

`public static OfficeRasterFrames DecodeFrames(byte[] bytes, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info, int maximumFrames = 256)` [#](#method-decodeframes-byte-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterdecodeinfo-int32)

[OfficeRasterImageDecoder.Convenience.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L28)

Decodes every frame or page and retains source descriptors and complete-sequence evidence.

Parameters

**bytes byte[] required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

**maximumFrames int = 256 optional**

Returns

`OfficeRasterFrames`

`public static OfficeRasterFrames DecodeFrames(Stream stream, OfficeRasterDecodeOptions? options = null, int maximumFrames = 256)` [#](#method-decodeframes-io-stream-officeimo-drawing-officerasterdecodeoptions-int32)

[OfficeRasterImageDecoder.Convenience.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L34)

Decodes every frame or page from a stream, leaving it open and restoring its position when seekable.

Parameters

**stream System.IO.Stream required**

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

**maximumFrames int = 256 optional**

Returns

`OfficeRasterFrames`

`public static OfficeRasterFrames DecodeFrames(Stream stream, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info, int maximumFrames = 256)` [#](#method-decodeframes-io-stream-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterdecodeinfo-int32)

[OfficeRasterImageDecoder.Convenience.cs:38](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L38)

Decodes every stream frame or page with complete-sequence and source evidence.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

**maximumFrames int = 256 optional**

Returns

`OfficeRasterFrames`

`public static byte[] ReadEncodedBytes(Stream stream, OfficeRasterDecodeOptions? options = null)` [#](#method-readencodedbytes-io-stream-officeimo-drawing-officerasterdecodeoptions)

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

Reads owned encoded bytes within the shared raster size and working-memory limits.

Parameters

**stream System.IO.Stream required**

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

Returns

`byte[]`

Exceptions

- `InvalidDataException` – The input is empty, incomplete, or exceeds the configured limits.

TryDecode 4 overloads

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

[OfficeRasterImageDecoder.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.cs#L23)

Attempts to decode image bytes into an RGBA raster buffer supported by dependency-free export.

Parameters

**bytes byte[]? required**

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

Returns

`bool`

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

[OfficeRasterImageDecoder.cs:29](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.cs#L29)

Attempts to decode a bounded raster stream and leaves a seekable stream at its original position.

Parameters

**stream System.IO.Stream required**

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

Returns

`bool`

`public static bool TryDecode(Stream stream, OfficeRasterDecodeOptions? options, out OfficeRasterImage? image, out OfficeRasterDecodeInfo info)` [#](#method-trydecode-io-stream-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterimage-officeimo-drawing-officerasterdecodeinfo)

[OfficeRasterImageDecoder.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.cs#L39)

Attempts to decode a bounded raster stream using explicit selection, loss, resource, and cancellation policy.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

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

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

Returns

`bool`

`public static bool TryDecode(byte[]? bytes, OfficeRasterDecodeOptions? options, out OfficeRasterImage? image, out OfficeRasterDecodeInfo info)` [#](#method-trydecode-byte-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterimage-officeimo-drawing-officerasterdecodeinfo)

[OfficeRasterImageDecoder.cs:86](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.cs#L86)

Attempts to decode image bytes using explicit frame and animation-loss policy.

Parameters

**bytes byte[]? required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

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

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

Returns

`bool`

TryDecodeFrames 3 overloads

`public static bool TryDecodeFrames(Stream stream, OfficeRasterDecodeOptions? options, out OfficeRasterFrames? frames, out OfficeRasterDecodeInfo info, int maximumFrames = 256)` [#](#method-trydecodeframes-io-stream-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterframes-officeimo-drawing-officerasterdecodeinfo-int32)

[OfficeRasterImageDecoder.Convenience.cs:45](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Convenience.cs#L45)

Decodes every stream frame or page within limits, retaining failure evidence and preserving seekable position.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

**frames OfficeIMO.Drawing.OfficeRasterFrames? required**

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

**maximumFrames int = 256 optional**

Returns

`bool`

`public static bool TryDecodeFrames(byte[]? bytes, OfficeRasterDecodeOptions? options, out OfficeRasterFrames? frames, int maximumFrames = 256)` [#](#method-trydecodeframes-byte-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterframes-int32)

[OfficeRasterImageDecoder.Frames.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Frames.cs#L18)

Attempts to decode every image, rendered animation frame, or page into independent managed buffers.

Parameters

**bytes byte[]? required**

Encoded raster container.

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

Decode policy. MaximumDecodedPixels limits the entire decoded sequence.

**frames OfficeIMO.Drawing.OfficeRasterFrames? required**

Complete decoded sequence on success, otherwise null.

**maximumFrames int = 256 optional**

Maximum frame or page count, from one to 4096; the default is 256.

Returns

`bool`

`public static bool TryDecodeFrames(byte[]? bytes, OfficeRasterDecodeOptions? options, out OfficeRasterFrames? frames, out OfficeRasterDecodeInfo info, int maximumFrames = 256)` [#](#method-trydecodeframes-byte-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officerasterframes-officeimo-drawing-officerasterdecodeinfo-int32)

[OfficeRasterImageDecoder.Frames.cs:25](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.Frames.cs#L25)

Decodes a complete bounded sequence and retains detected format, source descriptors, and failure evidence.

Parameters

**bytes byte[]? required**

**options OfficeIMO.Drawing.OfficeRasterDecodeOptions? required**

**frames OfficeIMO.Drawing.OfficeRasterFrames? required**

**info OfficeIMO.Drawing.OfficeRasterDecodeInfo required**

**maximumFrames int = 256 optional**

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?`

## Fields

`public const string SupportedFormatDescription` [#](#field-supportedformatdescription)

[OfficeRasterImageDecoder.cs:17](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/Raster/OfficeRasterImageDecoder.cs#L17)

Human-readable summary of raster formats currently decoded by the managed renderer.

Value: `PNG and APNG frames, JPEG, bounded classic TIFF pages, unsigned eight/sixteen-bit and finite fixed/floating-point gray/RGB JPEG XR, uncompressed BMP, explicitly selected GIF frames, lossless VP8L WebP, lossy VP8 WebP image bytes with optional raw or compressed alpha, bounded 8/10-bit YUV420 or monochrome AVIF still items with optional straight alpha, bounded PNG/DIB icon entries, portable bitmap/graymap/pixmap, and the managed TGA subset`

<!-- PowerForge markdown artifact sha256:CB3B089A82439E2B3EA2EB46DE06EFDCB33542EACDC850E7DB352AD3244D0E09 -->
