Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeRasterImageDecoder

OfficeIMO.Drawing

Namespace
OfficeIMO.Drawing
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
Modifiers
static

Shared dependency-free decoder for raster image bytes that can be painted by 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.

Methods

Decode 4 overloads
public static OfficeRasterImage Decode(byte[] bytes, OfficeRasterDecodeOptions? options = null) #

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

Parameters

bytes byte[] required
options OfficeIMO.Drawing.OfficeRasterDecodeOptions? = null optional
public static OfficeRasterImage Decode(byte[] bytes, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info) #

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
public static OfficeRasterImage Decode(Stream stream, OfficeRasterDecodeOptions? options = null) #

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
public static OfficeRasterImage Decode(Stream stream, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info) #

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
DecodeFrames 4 overloads
public static OfficeRasterFrames DecodeFrames(byte[] bytes, OfficeRasterDecodeOptions? options = null, int maximumFrames = 256) #

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
public static OfficeRasterFrames DecodeFrames(byte[] bytes, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info, int maximumFrames = 256) #

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
public static OfficeRasterFrames DecodeFrames(Stream stream, OfficeRasterDecodeOptions? options = null, int maximumFrames = 256) #

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
public static OfficeRasterFrames DecodeFrames(Stream stream, OfficeRasterDecodeOptions? options, out OfficeRasterDecodeInfo info, int maximumFrames = 256) #

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
public static byte[] ReadEncodedBytes(Stream stream, OfficeRasterDecodeOptions? options = null) #

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) #

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) #

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) #

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) #

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) #

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) #

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) #

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

Fields

public const string SupportedFormatDescription #

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