CodeGlyphX logo
CodeGlyphX

API Reference

Class

ImageReader

Namespace CodeGlyphX.Rendering
Assembly CodeGlyphX
Modifiers static

Auto-detects common image formats and decodes to RGBA buffers.

Inheritance

  • Object
  • ImageReader

Methods

DecodeAnimationCanvasFrames 6 overloads
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Stream stream, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: ImageAnimationFrame[]

Decodes animation frames composited onto a full canvas (auto-detected).

Parameters

data System.Byte[] requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 3
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #
Returns: ImageAnimationFrame[]

Decodes animation frames composited onto a full canvas (auto-detected) with decode options.

Parameters

data System.Byte[] requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 4
DecodeAnimationCanvasFrames(System.ReadOnlySpan{System.Byte} data, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ options) #

Decodes animation frames composited onto a full canvas (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} required
width System.Int32@ required
height System.Int32@ required
options CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationCanvasFrames(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ animationOptions) #

Decodes animation frames composited onto a full canvas (auto-detected) with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationCanvasFrames(System.IO.Stream stream, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ options) #

Decodes animation frames composited onto a full canvas from a stream (auto-detected).

Parameters

stream System.IO.Stream required
width System.Int32@ required
height System.Int32@ required
options CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationCanvasFrames(System.IO.Stream stream, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ animationOptions) #

Decodes animation frames composited onto a full canvas from a stream (auto-detected) with decode options.

Parameters

stream System.IO.Stream required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationFrames 6 overloads
public static ImageAnimationFrame[] DecodeAnimationFrames(Stream stream, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: ImageAnimationFrame[]

Decodes animation frames (non-composited) (auto-detected).

Parameters

data System.Byte[] requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 3
public static ImageAnimationFrame[] DecodeAnimationFrames(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #
Returns: ImageAnimationFrame[]

Decodes animation frames (non-composited) (auto-detected) with decode options.

Parameters

data System.Byte[] requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 4
DecodeAnimationFrames(System.ReadOnlySpan{System.Byte} data, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ options) #

Decodes animation frames (non-composited) (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} required
width System.Int32@ required
height System.Int32@ required
options CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationFrames(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ animationOptions) #

Decodes animation frames (non-composited) (auto-detected) with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationFrames(System.IO.Stream stream, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ options) #

Decodes animation frames (non-composited) from a stream (auto-detected).

Parameters

stream System.IO.Stream required
width System.Int32@ required
height System.Int32@ required
options CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeAnimationFrames(System.IO.Stream stream, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height, CodeGlyphX.Rendering.ImageAnimationOptions@ animationOptions) #

Decodes animation frames (non-composited) from a stream (auto-detected) with decode options.

Parameters

stream System.IO.Stream required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ required
DecodeGifAnimationCanvasFrames 2 overloads
public static GifAnimationFrame[] DecodeGifAnimationCanvasFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #
Returns: GifAnimationFrame[]

Decodes GIF animation frames composited onto the full canvas.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ requiredposition: 3
DecodeGifAnimationCanvasFrames(System.Byte[] data, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Gif.GifAnimationOptions@ options) #

Decodes GIF animation frames composited onto the full canvas.

Parameters

data System.Byte[] required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ required
DecodeGifAnimationFrames 2 overloads
public static GifAnimationFrame[] DecodeGifAnimationFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #
Returns: GifAnimationFrame[]

Decodes GIF animation frames into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ requiredposition: 3
DecodeGifAnimationFrames(System.Byte[] data, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Gif.GifAnimationOptions@ options) #

Decodes GIF animation frames into RGBA32 buffers.

Parameters

data System.Byte[] required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ required
DecodeRgba32 9 overloads
public static Byte[] DecodeRgba32(Stream stream, out Int32 width, out Int32 height) #
Returns: Byte[]

Decodes an image to an RGBA buffer (auto-detected).

Parameters

data System.Byte[] requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
public static Byte[] DecodeRgba32(Stream stream, Int32 pageIndex, out Int32 width, out Int32 height) #
Returns: Byte[]

Decodes an image to an RGBA buffer (auto-detected) with decode options.

Parameters

data System.Byte[] requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
DecodeRgba32(System.Byte[] data, System.Int32 pageIndex, System.Int32@ width, System.Int32@ height) #

Decodes a multipage image to an RGBA buffer (auto-detected).

Parameters

data System.Byte[] required
pageIndex System.Int32 required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32(System.ReadOnlySpan{System.Byte} data, System.Int32@ width, System.Int32@ height) #

Decodes an image to an RGBA buffer (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height) #

Decodes an image to an RGBA buffer (auto-detected) with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32(System.ReadOnlySpan{System.Byte} data, System.Int32 pageIndex, System.Int32@ width, System.Int32@ height) #

Decodes a multipage image to an RGBA buffer (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} required
pageIndex System.Int32 required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32(System.IO.Stream stream, System.Int32@ width, System.Int32@ height) #

Decodes an image stream to an RGBA buffer (auto-detected).

Parameters

stream System.IO.Stream required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32(System.IO.Stream stream, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height) #

Decodes an image stream to an RGBA buffer (auto-detected) with decode options.

Parameters

stream System.IO.Stream required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32(System.IO.Stream stream, System.Int32 pageIndex, System.Int32@ width, System.Int32@ height) #

Decodes a multipage image stream to an RGBA buffer (auto-detected).

Parameters

stream System.IO.Stream required
pageIndex System.Int32 required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32Composite 6 overloads
public static Byte[] DecodeRgba32Composite(Stream stream, out Int32 width, out Int32 height) #
Returns: Byte[]

Decodes an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.

Parameters

data System.Byte[] requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
public static Byte[] DecodeRgba32Composite(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height) #
Returns: Byte[]

Decodes an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

data System.Byte[] requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3

Examples


var options = new ImageDecodeOptions()
    .WithJpegOptions(highQualityChroma: true, allowTruncated: true);
var rgba = ImageReader.DecodeRgba32Composite(bytes, options, out var width, out var height);
                
DecodeRgba32Composite(System.ReadOnlySpan{System.Byte} data, System.Int32@ width, System.Int32@ height) #

Decodes an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.

Parameters

data System.ReadOnlySpan{System.Byte} required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32Composite(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height) #

Decodes an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required

Examples


var options = new ImageDecodeOptions()
    .WithJpegOptions(highQualityChroma: true);
var rgba = ImageReader.DecodeRgba32Composite(data, options, out var width, out var height);
                
DecodeRgba32Composite(System.IO.Stream stream, System.Int32@ width, System.Int32@ height) #

Decodes an image stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available.

Parameters

stream System.IO.Stream required
width System.Int32@ required
height System.Int32@ required
DecodeRgba32Composite(System.IO.Stream stream, CodeGlyphX.ImageDecodeOptions options, System.Int32@ width, System.Int32@ height) #

Decodes an image stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

stream System.IO.Stream required
options CodeGlyphX.ImageDecodeOptions required
width System.Int32@ required
height System.Int32@ required

Examples


using var stream = File.OpenRead("image.jpg");
var options = new ImageDecodeOptions().WithJpegOptions(highQualityChroma: true);
var rgba = ImageReader.DecodeRgba32Composite(stream, options, out var width, out var height);
                
DecodeRgba32Safe 2 overloads
public static Byte[] DecodeRgba32Safe(Stream stream, out Int32 width, out Int32 height) #
Returns: Byte[]

Decodes an image to an RGBA buffer (auto-detected) using safe defaults for untrusted inputs.

Parameters

data System.Byte[] requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
DecodeRgba32Safe(System.IO.Stream stream, System.Int32@ width, System.Int32@ height) #

Decodes an image stream to an RGBA buffer (auto-detected) using safe defaults for untrusted inputs.

Parameters

stream System.IO.Stream required
width System.Int32@ required
height System.Int32@ required
DecodeTiffPagesRgba32 3 overloads
public static TiffRgba32Page[] DecodeTiffPagesRgba32(ReadOnlySpan<Byte> data) #
Returns: TiffRgba32Page[]

Decodes all TIFF pages into RGBA32 buffers.

Parameters

data System.Byte[] requiredposition: 0
DecodeTiffPagesRgba32(System.IO.Stream stream) #

Decodes all TIFF pages into RGBA32 buffers.

Parameters

stream System.IO.Stream required
DecodeTiffPagesRgba32(System.ReadOnlySpan{System.Byte} data) #

Decodes all TIFF pages into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} required
DecodeWebpAnimationCanvasFrames 2 overloads
public static WebpAnimationFrame[] DecodeWebpAnimationCanvasFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #
Returns: WebpAnimationFrame[]

Decodes WebP animation frames composited onto the full canvas.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ requiredposition: 3
DecodeWebpAnimationCanvasFrames(System.Byte[] data, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ options) #

Decodes WebP animation frames composited onto the full canvas.

Parameters

data System.Byte[] required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ required
DecodeWebpAnimationFrames 2 overloads
public static WebpAnimationFrame[] DecodeWebpAnimationFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #
Returns: WebpAnimationFrame[]

Decodes WebP animation frames into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ requiredposition: 3
DecodeWebpAnimationFrames(System.Byte[] data, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ options) #

Decodes WebP animation frames into RGBA32 buffers.

Parameters

data System.Byte[] required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ required
public static ImageFormat DetectFormat(ReadOnlySpan<Byte> data) #
Returns: ImageFormat

Detects the image format from a byte buffer.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
TryDecodeAnimationCanvasFrames 2 overloads
public static Boolean TryDecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: Boolean

Attempts to decode animation frames composited onto a full canvas (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
frames CodeGlyphX.Rendering.ImageAnimationFrame[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
options CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 4
public static Boolean TryDecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #
Returns: Boolean

Attempts to decode animation frames composited onto a full canvas (auto-detected) with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
frames CodeGlyphX.Rendering.ImageAnimationFrame[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 5
TryDecodeAnimationFrames 2 overloads
public static Boolean TryDecodeAnimationFrames(ReadOnlySpan<Byte> data, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: Boolean

Attempts to decode animation frames (non-composited) (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
frames CodeGlyphX.Rendering.ImageAnimationFrame[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
options CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 4
public static Boolean TryDecodeAnimationFrames(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #
Returns: Boolean

Attempts to decode animation frames (non-composited) (auto-detected) with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
frames CodeGlyphX.Rendering.ImageAnimationFrame[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 5
TryDecodeGifAnimationCanvasFrames 3 overloads
public static Boolean TryDecodeGifAnimationCanvasFrames(Stream stream, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #
Returns: Boolean

Attempts to decode GIF animation frames composited onto the full canvas.

Parameters

data System.Byte[] requiredposition: 0
frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ requiredposition: 1
canvasWidth System.Int32@ requiredposition: 2
canvasHeight System.Int32@ requiredposition: 3
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ requiredposition: 4
TryDecodeGifAnimationCanvasFrames(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Gif.GifAnimationOptions@ options) #

Attempts to decode GIF animation frames composited onto the full canvas.

Parameters

data System.ReadOnlySpan{System.Byte} required
frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ required
TryDecodeGifAnimationCanvasFrames(System.IO.Stream stream, CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Gif.GifAnimationOptions@ options) #

Attempts to decode GIF animation canvas frames from a stream.

Parameters

stream System.IO.Stream required
frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ required
TryDecodeGifAnimationFrames 3 overloads
public static Boolean TryDecodeGifAnimationFrames(Stream stream, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #
Returns: Boolean

Attempts to decode GIF animation frames into RGBA32 buffers.

Parameters

data System.Byte[] requiredposition: 0
frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ requiredposition: 1
canvasWidth System.Int32@ requiredposition: 2
canvasHeight System.Int32@ requiredposition: 3
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ requiredposition: 4
TryDecodeGifAnimationFrames(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Gif.GifAnimationOptions@ options) #

Attempts to decode GIF animation frames into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} required
frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ required
TryDecodeGifAnimationFrames(System.IO.Stream stream, CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Gif.GifAnimationOptions@ options) #

Attempts to decode GIF animation frames from a stream.

Parameters

stream System.IO.Stream required
frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ required
TryDecodeRgba32 7 overloads
public static Boolean TryDecodeRgba32(ReadOnlySpan<Byte> data, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

Attempts to decode an image to an RGBA buffer (auto-detected).

Parameters

data System.Byte[] requiredposition: 0
rgba System.Byte[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
public static Boolean TryDecodeRgba32(ReadOnlySpan<Byte> data, Int32 pageIndex, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

Attempts to decode an image to an RGBA buffer (auto-detected) with decode options.

Parameters

data System.Byte[] requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
rgba System.Byte[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4
TryDecodeRgba32(System.IO.Stream stream, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image stream to an RGBA buffer (auto-detected).

Parameters

stream System.IO.Stream required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32(System.IO.Stream stream, CodeGlyphX.ImageDecodeOptions options, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image stream to an RGBA buffer (auto-detected) with decode options.

Parameters

stream System.IO.Stream required
options CodeGlyphX.ImageDecodeOptions required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32(System.ReadOnlySpan{System.Byte} data, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image to an RGBA buffer (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.ImageDecodeOptions options, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image to an RGBA buffer (auto-detected) with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} required
options CodeGlyphX.ImageDecodeOptions required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32(System.ReadOnlySpan{System.Byte} data, System.Int32 pageIndex, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode a multipage image to an RGBA buffer (auto-detected).

Parameters

data System.ReadOnlySpan{System.Byte} required
pageIndex System.Int32 required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32Composite 6 overloads
public static Boolean TryDecodeRgba32Composite(ReadOnlySpan<Byte> data, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

Attempts to decode an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.

Parameters

data System.Byte[] requiredposition: 0
rgba System.Byte[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
public static Boolean TryDecodeRgba32Composite(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

Attempts to decode an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

data System.Byte[] requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
rgba System.Byte[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4

Examples


var options = new ImageDecodeOptions().WithJpegOptions(allowTruncated: true);
if (ImageReader.TryDecodeRgba32Composite(bytes, options, out var rgba, out var width, out var height)) {
    Console.WriteLine($\"{width}x{height}\");
}
                
TryDecodeRgba32Composite(System.IO.Stream stream, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available.

Parameters

stream System.IO.Stream required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32Composite(System.IO.Stream stream, CodeGlyphX.ImageDecodeOptions options, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

stream System.IO.Stream required
options CodeGlyphX.ImageDecodeOptions required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required

Examples


using var stream = File.OpenRead("image.jpg");
var options = new ImageDecodeOptions().WithJpegOptions(highQualityChroma: true);
if (ImageReader.TryDecodeRgba32Composite(stream, options, out var rgba, out var width, out var height)) {
    Console.WriteLine($\"{width}x{height}\");
}
                
TryDecodeRgba32Composite(System.ReadOnlySpan{System.Byte} data, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.

Parameters

data System.ReadOnlySpan{System.Byte} required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeRgba32Composite(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.ImageDecodeOptions options, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

data System.ReadOnlySpan{System.Byte} required
options CodeGlyphX.ImageDecodeOptions required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required

Examples


var options = new ImageDecodeOptions().WithJpegOptions(highQualityChroma: true);
if (ImageReader.TryDecodeRgba32Composite(data, options, out var rgba, out var width, out var height)) {
    Console.WriteLine($\"{width}x{height}\");
}
                
TryDecodeRgba32Safe 2 overloads
public static Boolean TryDecodeRgba32Safe(Stream stream, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

Attempts to decode an image to an RGBA buffer (auto-detected) using safe defaults for untrusted inputs.

Parameters

data System.Byte[] requiredposition: 0
rgba System.Byte[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
TryDecodeRgba32Safe(System.IO.Stream stream, System.Byte[]@ rgba, System.Int32@ width, System.Int32@ height) #

Attempts to decode an image stream to an RGBA buffer (auto-detected) using safe defaults for untrusted inputs.

Parameters

stream System.IO.Stream required
rgba System.Byte[]@ required
width System.Int32@ required
height System.Int32@ required
TryDecodeTiffPagesRgba32 3 overloads
public static Boolean TryDecodeTiffPagesRgba32(Stream stream, out TiffRgba32Page[] pages) #
Returns: Boolean

Attempts to decode all TIFF pages into RGBA32 buffers.

Parameters

data System.Byte[] requiredposition: 0
pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ requiredposition: 1
TryDecodeTiffPagesRgba32(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ pages) #

Attempts to decode all TIFF pages into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} required
pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ required
TryDecodeTiffPagesRgba32(System.IO.Stream stream, CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ pages) #

Attempts to decode all TIFF pages into RGBA32 buffers from a stream.

Parameters

stream System.IO.Stream required
pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ required
TryDecodeWebpAnimationCanvasFrames 3 overloads
public static Boolean TryDecodeWebpAnimationCanvasFrames(Stream stream, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #
Returns: Boolean

Attempts to decode WebP animation frames composited onto the full canvas.

Parameters

data System.Byte[] requiredposition: 0
frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ requiredposition: 1
canvasWidth System.Int32@ requiredposition: 2
canvasHeight System.Int32@ requiredposition: 3
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ requiredposition: 4
TryDecodeWebpAnimationCanvasFrames(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ options) #

Attempts to decode WebP animation frames composited onto the full canvas.

Parameters

data System.ReadOnlySpan{System.Byte} required
frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ required
TryDecodeWebpAnimationCanvasFrames(System.IO.Stream stream, CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ options) #

Attempts to decode WebP animation canvas frames from a stream.

Parameters

stream System.IO.Stream required
frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ required
TryDecodeWebpAnimationFrames 3 overloads
public static Boolean TryDecodeWebpAnimationFrames(Stream stream, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #
Returns: Boolean

Attempts to decode WebP animation frames into RGBA32 buffers.

Parameters

data System.Byte[] requiredposition: 0
frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ requiredposition: 1
canvasWidth System.Int32@ requiredposition: 2
canvasHeight System.Int32@ requiredposition: 3
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ requiredposition: 4
TryDecodeWebpAnimationFrames(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ options) #

Attempts to decode WebP animation frames into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} required
frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ required
TryDecodeWebpAnimationFrames(System.IO.Stream stream, CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ frames, System.Int32@ canvasWidth, System.Int32@ canvasHeight, CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ options) #

Attempts to decode WebP animation frames from a stream.

Parameters

stream System.IO.Stream required
frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@ required
canvasWidth System.Int32@ required
canvasHeight System.Int32@ required
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ required
public static Boolean TryDetectFormat(ReadOnlySpan<Byte> data, out ImageFormat format) #
Returns: Boolean

Attempts to detect the image format from a byte buffer.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
format CodeGlyphX.Rendering.ImageFormat@ requiredposition: 1
TryReadAnimationInfo 3 overloads
public static Boolean TryReadAnimationInfo(Stream stream, out ImageAnimationInfo info) #
Returns: Boolean

Attempts to read animation format info without decoding pixels.

Parameters

data System.Byte[] requiredposition: 0
info CodeGlyphX.Rendering.ImageAnimationInfo@ requiredposition: 1
TryReadAnimationInfo(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.ImageAnimationInfo@ info) #

Attempts to read animation format info without decoding pixels.

Parameters

data System.ReadOnlySpan{System.Byte} required
info CodeGlyphX.Rendering.ImageAnimationInfo@ required
TryReadAnimationInfo(System.IO.Stream stream, CodeGlyphX.Rendering.ImageAnimationInfo@ info) #

Attempts to read animation format info from a stream without decoding pixels.

Parameters

stream System.IO.Stream required
info CodeGlyphX.Rendering.ImageAnimationInfo@ required
TryReadInfo 6 overloads
public static Boolean TryReadInfo(Stream stream, out ImageInfo info) #
Returns: Boolean

Attempts to read image format and dimensions without decoding pixels.

Parameters

data System.Byte[] requiredposition: 0
info CodeGlyphX.Rendering.ImageInfo@ requiredposition: 1
public static Boolean TryReadInfo(Stream stream, Int32 pageIndex, out ImageInfo info) #
Returns: Boolean

Attempts to read image format and dimensions for a given page without decoding pixels.

Parameters

data System.Byte[] requiredposition: 0
pageIndex System.Int32 requiredposition: 1
info CodeGlyphX.Rendering.ImageInfo@ requiredposition: 2
TryReadInfo(System.ReadOnlySpan{System.Byte} data, CodeGlyphX.Rendering.ImageInfo@ info) #

Attempts to read image format and dimensions without decoding pixels.

Parameters

data System.ReadOnlySpan{System.Byte} required
info CodeGlyphX.Rendering.ImageInfo@ required
TryReadInfo(System.ReadOnlySpan{System.Byte} data, System.Int32 pageIndex, CodeGlyphX.Rendering.ImageInfo@ info) #

Attempts to read image format and dimensions for a given page without decoding pixels.

Parameters

data System.ReadOnlySpan{System.Byte} required
pageIndex System.Int32 required
info CodeGlyphX.Rendering.ImageInfo@ required
TryReadInfo(System.IO.Stream stream, CodeGlyphX.Rendering.ImageInfo@ info) #

Attempts to read image format and dimensions from a stream without decoding pixels.

Parameters

stream System.IO.Stream required
info CodeGlyphX.Rendering.ImageInfo@ required
TryReadInfo(System.IO.Stream stream, System.Int32 pageIndex, CodeGlyphX.Rendering.ImageInfo@ info) #

Attempts to read image format and dimensions for a given page from a stream without decoding pixels.

Parameters

stream System.IO.Stream required
pageIndex System.Int32 required
info CodeGlyphX.Rendering.ImageInfo@ required
TryReadPageCount 3 overloads
public static Boolean TryReadPageCount(Stream stream, out Int32 pageCount) #
Returns: Boolean

Attempts to read page count for multipage images (TIFF).

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
pageCount System.Int32@ requiredposition: 1
TryReadPageCount(System.Byte[] data, System.Int32@ pageCount) #

Attempts to read page count for multipage images (TIFF) from a byte buffer.

Parameters

data System.Byte[] required
pageCount System.Int32@ required
TryReadPageCount(System.IO.Stream stream, System.Int32@ pageCount) #

Attempts to read page count for multipage images (TIFF) from a stream.

Parameters

stream System.IO.Stream required
pageCount System.Int32@ required

Properties

public static Int64 MaxPixels { get; set; } #

Maximum pixel count allowed for managed decodes (width * height). Set to 0 to disable.

public static Int32 MaxImageBytes { get; set; } #

Maximum image payload size (bytes) for stream decoding. Set to 0 to disable.

public static Int32 MaxAnimationFrames { get; set; } #

Maximum animation frame count allowed for managed decodes. Set to 0 to disable.

public static Int32 MaxAnimationDurationMs { get; set; } #

Maximum total animation duration (milliseconds) allowed for managed decodes. Set to 0 to disable.

public static Int64 MaxAnimationFramePixels { get; set; } #

Maximum pixel count allowed per animation frame. Set to 0 to disable.

Fields

public const Int64 DefaultMaxPixels #

Default maximum pixel count allowed for managed decodes (~50,000,000 pixels). (~200 MB RGBA or roughly 14k x 3.5k).

Value: 50000000
public const Int32 DefaultMaxImageBytes #

Default maximum image payload size (bytes) for stream decoding (~128 MB).

Value: 134217728
public const Int32 DefaultMaxAnimationFrames #

Default maximum animation frame count allowed for managed decodes.

Value: 256
public const Int32 DefaultMaxAnimationDurationMs #

Default maximum total animation duration (milliseconds) for managed decodes.

Value: 120000
public const Int64 DefaultMaxAnimationFramePixels #

Default maximum animation frame pixel count allowed for managed decodes.

Value: 50000000

Events

public static event Action<ImageDecodeLimitViolation> LimitViolation #

Optional handler invoked when decode limits are violated.