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(Byte[] data, 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(Byte[] data, 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
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: ImageAnimationFrame[]

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

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 3
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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
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 from a stream (auto-detected).

Parameters

stream System.IO.Stream 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 from a stream (auto-detected) with decode options.

Parameters

stream System.IO.Stream requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 4
DecodeAnimationFrames 6 overloads
public static ImageAnimationFrame[] DecodeAnimationFrames(Byte[] data, 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(Byte[] data, 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
public static ImageAnimationFrame[] DecodeAnimationFrames(ReadOnlySpan<Byte> data, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: ImageAnimationFrame[]

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

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 3
public static ImageAnimationFrame[] DecodeAnimationFrames(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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
public static ImageAnimationFrame[] DecodeAnimationFrames(Stream stream, out Int32 width, out Int32 height, out ImageAnimationOptions options) #
Returns: ImageAnimationFrame[]

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

Parameters

stream System.IO.Stream 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) from a stream (auto-detected) with decode options.

Parameters

stream System.IO.Stream requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@ requiredposition: 4
DecodeGifAnimationCanvasFrames 2 overloads
public static GifAnimationFrame[] DecodeGifAnimationCanvasFrames(ReadOnlySpan<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
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.Byte[] requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ requiredposition: 3
DecodeGifAnimationFrames 2 overloads
public static GifAnimationFrame[] DecodeGifAnimationFrames(ReadOnlySpan<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
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.Byte[] requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Gif.GifAnimationOptions@ requiredposition: 3
DecodeRgba32 9 overloads
public static Byte[] DecodeRgba32(Byte[] data, 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(Byte[] data, ImageDecodeOptions options, 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
public static Byte[] DecodeRgba32(Byte[] data, Int32 pageIndex, out Int32 width, out Int32 height) #
Returns: Byte[]

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

Parameters

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

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

Parameters

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

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

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
public static Byte[] DecodeRgba32(ReadOnlySpan<Byte> data, Int32 pageIndex, out Int32 width, out Int32 height) #
Returns: Byte[]

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

Parameters

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

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

Parameters

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

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

Parameters

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

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

Parameters

stream System.IO.Stream requiredposition: 0
pageIndex System.Int32 requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
DecodeRgba32Composite 6 overloads
public static Byte[] DecodeRgba32Composite(Byte[] data, 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(Byte[] data, 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);
                
public static Byte[] DecodeRgba32Composite(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{System.Byte} requiredposition: 0
width System.Int32@ requiredposition: 1
height System.Int32@ requiredposition: 2
public static Byte[] DecodeRgba32Composite(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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);
var rgba = ImageReader.DecodeRgba32Composite(data, options, out var width, out var height);
                
public static Byte[] DecodeRgba32Composite(Stream stream, out Int32 width, out Int32 height) #
Returns: Byte[]

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

Parameters

stream System.IO.Stream 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 stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available, with decode options.

Parameters

stream System.IO.Stream requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3

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);
                
DecodeTiffPagesRgba32 3 overloads
public static TiffRgba32Page[] DecodeTiffPagesRgba32(Byte[] data) #
Returns: TiffRgba32Page[]

Decodes all TIFF pages into RGBA32 buffers.

Parameters

data System.Byte[] requiredposition: 0
public static TiffRgba32Page[] DecodeTiffPagesRgba32(Stream stream) #
Returns: TiffRgba32Page[]

Decodes all TIFF pages into RGBA32 buffers.

Parameters

stream System.IO.Stream requiredposition: 0
public static TiffRgba32Page[] DecodeTiffPagesRgba32(ReadOnlySpan<Byte> data) #
Returns: TiffRgba32Page[]

Decodes all TIFF pages into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
DecodeWebpAnimationCanvasFrames 2 overloads
public static WebpAnimationFrame[] DecodeWebpAnimationCanvasFrames(ReadOnlySpan<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
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.Byte[] requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ requiredposition: 3
DecodeWebpAnimationFrames 2 overloads
public static WebpAnimationFrame[] DecodeWebpAnimationFrames(ReadOnlySpan<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
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.Byte[] requiredposition: 0
canvasWidth System.Int32@ requiredposition: 1
canvasHeight System.Int32@ requiredposition: 2
options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@ requiredposition: 3
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(Byte[] data, 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
public static Boolean TryDecodeGifAnimationCanvasFrames(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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
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 canvas frames from a stream.

Parameters

stream System.IO.Stream 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 3 overloads
public static Boolean TryDecodeGifAnimationFrames(Byte[] data, 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
public static Boolean TryDecodeGifAnimationFrames(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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
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 from a stream.

Parameters

stream System.IO.Stream 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
TryDecodeRgba32 7 overloads
public static Boolean TryDecodeRgba32(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(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) 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
public static Boolean TryDecodeRgba32(Stream stream, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

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

Parameters

stream System.IO.Stream requiredposition: 0
rgba System.Byte[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
public static Boolean TryDecodeRgba32(Stream stream, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

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

Parameters

stream System.IO.Stream requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
rgba System.Byte[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4
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.ReadOnlySpan{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, ImageDecodeOptions options, 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.ReadOnlySpan{System.Byte} requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
rgba System.Byte[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4
public static Boolean TryDecodeRgba32(ReadOnlySpan<Byte> data, Int32 pageIndex, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

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

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
pageIndex System.Int32 requiredposition: 1
rgba System.Byte[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4
TryDecodeRgba32Composite 6 overloads
public static Boolean TryDecodeRgba32Composite(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(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}\");
}
                
public static Boolean TryDecodeRgba32Composite(Stream stream, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

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 requiredposition: 0
rgba System.Byte[]@ requiredposition: 1
width System.Int32@ requiredposition: 2
height System.Int32@ requiredposition: 3
public static Boolean TryDecodeRgba32Composite(Stream stream, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #
Returns: Boolean

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 requiredposition: 0
options CodeGlyphX.ImageDecodeOptions requiredposition: 1
rgba System.Byte[]@ requiredposition: 2
width System.Int32@ requiredposition: 3
height System.Int32@ requiredposition: 4

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}\");
}
                
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.ReadOnlySpan{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.ReadOnlySpan{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(highQualityChroma: true);
if (ImageReader.TryDecodeRgba32Composite(data, options, out var rgba, out var width, out var height)) {
    Console.WriteLine($\"{width}x{height}\");
}
                
TryDecodeTiffPagesRgba32 3 overloads
public static Boolean TryDecodeTiffPagesRgba32(Byte[] data, 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
public static Boolean TryDecodeTiffPagesRgba32(ReadOnlySpan<Byte> data, out TiffRgba32Page[] pages) #
Returns: Boolean

Attempts to decode all TIFF pages into RGBA32 buffers.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ requiredposition: 1
public static Boolean TryDecodeTiffPagesRgba32(Stream stream, out TiffRgba32Page[] pages) #
Returns: Boolean

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

Parameters

stream System.IO.Stream requiredposition: 0
pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@ requiredposition: 1
TryDecodeWebpAnimationCanvasFrames 3 overloads
public static Boolean TryDecodeWebpAnimationCanvasFrames(Byte[] data, 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
public static Boolean TryDecodeWebpAnimationCanvasFrames(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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
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 canvas frames from a stream.

Parameters

stream System.IO.Stream 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 3 overloads
public static Boolean TryDecodeWebpAnimationFrames(Byte[] data, 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
public static Boolean TryDecodeWebpAnimationFrames(ReadOnlySpan<Byte> data, 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.ReadOnlySpan{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
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 from a stream.

Parameters

stream System.IO.Stream 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
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(Byte[] data, 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
public static Boolean TryReadAnimationInfo(ReadOnlySpan<Byte> data, out ImageAnimationInfo info) #
Returns: Boolean

Attempts to read animation format info without decoding pixels.

Parameters

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

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

Parameters

stream System.IO.Stream requiredposition: 0
info CodeGlyphX.Rendering.ImageAnimationInfo@ requiredposition: 1
TryReadInfo 6 overloads
public static Boolean TryReadInfo(Byte[] data, 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(Byte[] data, 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
public static Boolean TryReadInfo(ReadOnlySpan<Byte> data, out ImageInfo info) #
Returns: Boolean

Attempts to read image format and dimensions without decoding pixels.

Parameters

data System.ReadOnlySpan{System.Byte} requiredposition: 0
info CodeGlyphX.Rendering.ImageInfo@ requiredposition: 1
public static Boolean TryReadInfo(ReadOnlySpan<Byte> data, Int32 pageIndex, out ImageInfo info) #
Returns: Boolean

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

Parameters

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

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

Parameters

stream System.IO.Stream 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 from a stream without decoding pixels.

Parameters

stream System.IO.Stream requiredposition: 0
pageIndex System.Int32 requiredposition: 1
info CodeGlyphX.Rendering.ImageInfo@ requiredposition: 2
TryReadPageCount 3 overloads
public static Boolean TryReadPageCount(ReadOnlySpan<Byte> data, 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
public static Boolean TryReadPageCount(Byte[] data, out Int32 pageCount) #
Returns: Boolean

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

Parameters

data System.Byte[] requiredposition: 0
pageCount System.Int32@ requiredposition: 1
public static Boolean TryReadPageCount(Stream stream, out Int32 pageCount) #
Returns: Boolean

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

Parameters

stream System.IO.Stream requiredposition: 0
pageCount System.Int32@ requiredposition: 1

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.