API Reference
ImageReader
Auto-detects common image formats and decodes to RGBA buffers.
Inheritance
- Object
- ImageReader
Methods
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Byte[] data, out Int32 width, out Int32 height, out ImageAnimationOptions options) #ImageAnimationFrame[]Decodes animation frames composited onto a full canvas (auto-detected).
Parameters
- data System.Byte[]
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Byte[] data, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #ImageAnimationFrame[]Decodes animation frames composited onto a full canvas (auto-detected) with decode options.
Parameters
- data System.Byte[]
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, out Int32 width, out Int32 height, out ImageAnimationOptions options) #ImageAnimationFrame[]Decodes animation frames composited onto a full canvas (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #ImageAnimationFrame[]Decodes animation frames composited onto a full canvas (auto-detected) with decode options.
Parameters
- data System.ReadOnlySpan{System.Byte}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Stream stream, out Int32 width, out Int32 height, out ImageAnimationOptions options) #ImageAnimationFrame[]Decodes animation frames composited onto a full canvas from a stream (auto-detected).
Parameters
- stream System.IO.Stream
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #ImageAnimationFrame[]Decodes animation frames composited onto a full canvas from a stream (auto-detected) with decode options.
Parameters
- stream System.IO.Stream
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationFrames(Byte[] data, out Int32 width, out Int32 height, out ImageAnimationOptions options) #ImageAnimationFrame[]Decodes animation frames (non-composited) (auto-detected).
Parameters
- data System.Byte[]
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationFrames(Byte[] data, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #ImageAnimationFrame[]Decodes animation frames (non-composited) (auto-detected) with decode options.
Parameters
- data System.Byte[]
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationFrames(ReadOnlySpan<Byte> data, out Int32 width, out Int32 height, out ImageAnimationOptions options) #ImageAnimationFrame[]Decodes animation frames (non-composited) (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationFrames(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #ImageAnimationFrame[]Decodes animation frames (non-composited) (auto-detected) with decode options.
Parameters
- data System.ReadOnlySpan{System.Byte}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationFrames(Stream stream, out Int32 width, out Int32 height, out ImageAnimationOptions options) #ImageAnimationFrame[]Decodes animation frames (non-composited) from a stream (auto-detected).
Parameters
- stream System.IO.Stream
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static ImageAnimationFrame[] DecodeAnimationFrames(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #ImageAnimationFrame[]Decodes animation frames (non-composited) from a stream (auto-detected) with decode options.
Parameters
- stream System.IO.Stream
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static GifAnimationFrame[] DecodeGifAnimationCanvasFrames(ReadOnlySpan<Byte> data, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #GifAnimationFrame[]Decodes GIF animation frames composited onto the full canvas.
Parameters
- data System.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static GifAnimationFrame[] DecodeGifAnimationCanvasFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #GifAnimationFrame[]Decodes GIF animation frames composited onto the full canvas.
Parameters
- data System.Byte[]
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static GifAnimationFrame[] DecodeGifAnimationFrames(ReadOnlySpan<Byte> data, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #GifAnimationFrame[]Decodes GIF animation frames into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static GifAnimationFrame[] DecodeGifAnimationFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #GifAnimationFrame[]Decodes GIF animation frames into RGBA32 buffers.
Parameters
- data System.Byte[]
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Byte[] DecodeRgba32(Byte[] data, out Int32 width, out Int32 height) #Byte[]Decodes an image to an RGBA buffer (auto-detected).
Parameters
- data System.Byte[]
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(Byte[] data, ImageDecodeOptions options, out Int32 width, out Int32 height) #Byte[]Decodes an image to an RGBA buffer (auto-detected) with decode options.
Parameters
- data System.Byte[]
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(Byte[] data, Int32 pageIndex, out Int32 width, out Int32 height) #Byte[]Decodes a multipage image to an RGBA buffer (auto-detected).
Parameters
- data System.Byte[]
- pageIndex System.Int32
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(ReadOnlySpan<Byte> data, out Int32 width, out Int32 height) #Byte[]Decodes an image to an RGBA buffer (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Int32 width, out Int32 height) #Byte[]Decodes an image to an RGBA buffer (auto-detected) with decode options.
Parameters
- data System.ReadOnlySpan{System.Byte}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(ReadOnlySpan<Byte> data, Int32 pageIndex, out Int32 width, out Int32 height) #Byte[]Decodes a multipage image to an RGBA buffer (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- pageIndex System.Int32
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(Stream stream, out Int32 width, out Int32 height) #Byte[]Decodes an image stream to an RGBA buffer (auto-detected).
Parameters
- stream System.IO.Stream
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height) #Byte[]Decodes an image stream to an RGBA buffer (auto-detected) with decode options.
Parameters
- stream System.IO.Stream
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32(Stream stream, Int32 pageIndex, out Int32 width, out Int32 height) #Byte[]Decodes a multipage image stream to an RGBA buffer (auto-detected).
Parameters
- stream System.IO.Stream
- pageIndex System.Int32
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32Composite(Byte[] data, out Int32 width, out Int32 height) #Byte[]Decodes an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.
Parameters
- data System.Byte[]
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32Composite(Byte[] data, ImageDecodeOptions options, out Int32 width, out Int32 height) #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[]
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
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) #Byte[]Decodes an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.
Parameters
- data System.ReadOnlySpan{System.Byte}
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32Composite(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Int32 width, out Int32 height) #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}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
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) #Byte[]Decodes an image stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available.
Parameters
- stream System.IO.Stream
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32Composite(Stream stream, ImageDecodeOptions options, out Int32 width, out Int32 height) #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
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
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);
public static TiffRgba32Page[] DecodeTiffPagesRgba32(Byte[] data) #TiffRgba32Page[]Decodes all TIFF pages into RGBA32 buffers.
Parameters
- data System.Byte[]
public static TiffRgba32Page[] DecodeTiffPagesRgba32(Stream stream) #TiffRgba32Page[]Decodes all TIFF pages into RGBA32 buffers.
Parameters
- stream System.IO.Stream
public static TiffRgba32Page[] DecodeTiffPagesRgba32(ReadOnlySpan<Byte> data) #TiffRgba32Page[]Decodes all TIFF pages into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
public static WebpAnimationFrame[] DecodeWebpAnimationCanvasFrames(ReadOnlySpan<Byte> data, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #WebpAnimationFrame[]Decodes WebP animation frames composited onto the full canvas.
Parameters
- data System.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static WebpAnimationFrame[] DecodeWebpAnimationCanvasFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #WebpAnimationFrame[]Decodes WebP animation frames composited onto the full canvas.
Parameters
- data System.Byte[]
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static WebpAnimationFrame[] DecodeWebpAnimationFrames(ReadOnlySpan<Byte> data, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #WebpAnimationFrame[]Decodes WebP animation frames into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static WebpAnimationFrame[] DecodeWebpAnimationFrames(Byte[] data, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #WebpAnimationFrame[]Decodes WebP animation frames into RGBA32 buffers.
Parameters
- data System.Byte[]
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static ImageFormat DetectFormat(ReadOnlySpan<Byte> data) #ImageFormatDetects the image format from a byte buffer.
Parameters
- data System.ReadOnlySpan{System.Byte}
public static Boolean TryDecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions options) #BooleanAttempts to decode animation frames composited onto a full canvas (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- frames CodeGlyphX.Rendering.ImageAnimationFrame[]@
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static Boolean TryDecodeAnimationCanvasFrames(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #BooleanAttempts to decode animation frames composited onto a full canvas (auto-detected) with decode options.
Parameters
- data System.ReadOnlySpan{System.Byte}
- options CodeGlyphX.ImageDecodeOptions
- frames CodeGlyphX.Rendering.ImageAnimationFrame[]@
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static Boolean TryDecodeAnimationFrames(ReadOnlySpan<Byte> data, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions options) #BooleanAttempts to decode animation frames (non-composited) (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- frames CodeGlyphX.Rendering.ImageAnimationFrame[]@
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
public static Boolean TryDecodeAnimationFrames(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out ImageAnimationFrame[] frames, out Int32 width, out Int32 height, out ImageAnimationOptions animationOptions) #BooleanAttempts to decode animation frames (non-composited) (auto-detected) with decode options.
Parameters
- data System.ReadOnlySpan{System.Byte}
- options CodeGlyphX.ImageDecodeOptions
- frames CodeGlyphX.Rendering.ImageAnimationFrame[]@
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
public static Boolean TryDecodeGifAnimationCanvasFrames(Byte[] data, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #BooleanAttempts to decode GIF animation frames composited onto the full canvas.
Parameters
- data System.Byte[]
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Boolean TryDecodeGifAnimationCanvasFrames(ReadOnlySpan<Byte> data, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #BooleanAttempts to decode GIF animation frames composited onto the full canvas.
Parameters
- data System.ReadOnlySpan{System.Byte}
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Boolean TryDecodeGifAnimationCanvasFrames(Stream stream, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #BooleanAttempts to decode GIF animation canvas frames from a stream.
Parameters
- stream System.IO.Stream
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Boolean TryDecodeGifAnimationFrames(Byte[] data, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #BooleanAttempts to decode GIF animation frames into RGBA32 buffers.
Parameters
- data System.Byte[]
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Boolean TryDecodeGifAnimationFrames(ReadOnlySpan<Byte> data, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #BooleanAttempts to decode GIF animation frames into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Boolean TryDecodeGifAnimationFrames(Stream stream, out GifAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out GifAnimationOptions options) #BooleanAttempts to decode GIF animation frames from a stream.
Parameters
- stream System.IO.Stream
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Boolean TryDecodeRgba32(Byte[] data, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected).
Parameters
- data System.Byte[]
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32(Byte[] data, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected) with decode options.
Parameters
- data System.Byte[]
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32(Stream stream, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image stream to an RGBA buffer (auto-detected).
Parameters
- stream System.IO.Stream
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32(Stream stream, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image stream to an RGBA buffer (auto-detected) with decode options.
Parameters
- stream System.IO.Stream
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32(ReadOnlySpan<Byte> data, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected) with decode options.
Parameters
- data System.ReadOnlySpan{System.Byte}
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32(ReadOnlySpan<Byte> data, Int32 pageIndex, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode a multipage image to an RGBA buffer (auto-detected).
Parameters
- data System.ReadOnlySpan{System.Byte}
- pageIndex System.Int32
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32Composite(Byte[] data, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.
Parameters
- data System.Byte[]
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32Composite(Byte[] data, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts 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[]
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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) #BooleanAttempts to decode an image stream to an RGBA buffer (auto-detected), returning the first composited animation frame when available.
Parameters
- stream System.IO.Stream
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32Composite(Stream stream, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts 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
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected), returning the first composited animation frame when available.
Parameters
- data System.ReadOnlySpan{System.Byte}
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeRgba32Composite(ReadOnlySpan<Byte> data, ImageDecodeOptions options, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts 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}
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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}\");
}
public static Boolean TryDecodeTiffPagesRgba32(Byte[] data, out TiffRgba32Page[] pages) #BooleanAttempts to decode all TIFF pages into RGBA32 buffers.
Parameters
- data System.Byte[]
- pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@
public static Boolean TryDecodeTiffPagesRgba32(ReadOnlySpan<Byte> data, out TiffRgba32Page[] pages) #BooleanAttempts to decode all TIFF pages into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
- pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@
public static Boolean TryDecodeTiffPagesRgba32(Stream stream, out TiffRgba32Page[] pages) #BooleanAttempts to decode all TIFF pages into RGBA32 buffers from a stream.
Parameters
- stream System.IO.Stream
- pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@
public static Boolean TryDecodeWebpAnimationCanvasFrames(Byte[] data, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #BooleanAttempts to decode WebP animation frames composited onto the full canvas.
Parameters
- data System.Byte[]
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static Boolean TryDecodeWebpAnimationCanvasFrames(ReadOnlySpan<Byte> data, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #BooleanAttempts to decode WebP animation frames composited onto the full canvas.
Parameters
- data System.ReadOnlySpan{System.Byte}
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static Boolean TryDecodeWebpAnimationCanvasFrames(Stream stream, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #BooleanAttempts to decode WebP animation canvas frames from a stream.
Parameters
- stream System.IO.Stream
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static Boolean TryDecodeWebpAnimationFrames(Byte[] data, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #BooleanAttempts to decode WebP animation frames into RGBA32 buffers.
Parameters
- data System.Byte[]
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static Boolean TryDecodeWebpAnimationFrames(ReadOnlySpan<Byte> data, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #BooleanAttempts to decode WebP animation frames into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static Boolean TryDecodeWebpAnimationFrames(Stream stream, out WebpAnimationFrame[] frames, out Int32 canvasWidth, out Int32 canvasHeight, out WebpAnimationOptions options) #BooleanAttempts to decode WebP animation frames from a stream.
Parameters
- stream System.IO.Stream
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
public static Boolean TryDetectFormat(ReadOnlySpan<Byte> data, out ImageFormat format) #BooleanAttempts to detect the image format from a byte buffer.
Parameters
- data System.ReadOnlySpan{System.Byte}
- format CodeGlyphX.Rendering.ImageFormat@
public static Boolean TryReadAnimationInfo(Byte[] data, out ImageAnimationInfo info) #BooleanAttempts to read animation format info without decoding pixels.
Parameters
- data System.Byte[]
- info CodeGlyphX.Rendering.ImageAnimationInfo@
public static Boolean TryReadAnimationInfo(ReadOnlySpan<Byte> data, out ImageAnimationInfo info) #BooleanAttempts to read animation format info without decoding pixels.
Parameters
- data System.ReadOnlySpan{System.Byte}
- info CodeGlyphX.Rendering.ImageAnimationInfo@
public static Boolean TryReadAnimationInfo(Stream stream, out ImageAnimationInfo info) #BooleanAttempts to read animation format info from a stream without decoding pixels.
Parameters
- stream System.IO.Stream
- info CodeGlyphX.Rendering.ImageAnimationInfo@
public static Boolean TryReadInfo(Byte[] data, out ImageInfo info) #BooleanAttempts to read image format and dimensions without decoding pixels.
Parameters
- data System.Byte[]
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadInfo(Byte[] data, Int32 pageIndex, out ImageInfo info) #BooleanAttempts to read image format and dimensions for a given page without decoding pixels.
Parameters
- data System.Byte[]
- pageIndex System.Int32
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadInfo(ReadOnlySpan<Byte> data, out ImageInfo info) #BooleanAttempts to read image format and dimensions without decoding pixels.
Parameters
- data System.ReadOnlySpan{System.Byte}
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadInfo(ReadOnlySpan<Byte> data, Int32 pageIndex, out ImageInfo info) #BooleanAttempts to read image format and dimensions for a given page without decoding pixels.
Parameters
- data System.ReadOnlySpan{System.Byte}
- pageIndex System.Int32
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadInfo(Stream stream, out ImageInfo info) #BooleanAttempts to read image format and dimensions from a stream without decoding pixels.
Parameters
- stream System.IO.Stream
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadInfo(Stream stream, Int32 pageIndex, out ImageInfo info) #BooleanAttempts to read image format and dimensions for a given page from a stream without decoding pixels.
Parameters
- stream System.IO.Stream
- pageIndex System.Int32
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadPageCount(ReadOnlySpan<Byte> data, out Int32 pageCount) #BooleanAttempts to read page count for multipage images (TIFF).
Parameters
- data System.ReadOnlySpan{System.Byte}
- pageCount System.Int32@
public static Boolean TryReadPageCount(Byte[] data, out Int32 pageCount) #BooleanAttempts to read page count for multipage images (TIFF) from a byte buffer.
Parameters
- data System.Byte[]
- pageCount System.Int32@
public static Boolean TryReadPageCount(Stream stream, out Int32 pageCount) #BooleanAttempts to read page count for multipage images (TIFF) from a stream.
Parameters
- stream System.IO.Stream
- pageCount System.Int32@
Inherited Methods
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).
50000000public const Int32 DefaultMaxImageBytes #Default maximum image payload size (bytes) for stream decoding (~128 MB).
134217728public const Int32 DefaultMaxAnimationFrames #Default maximum animation frame count allowed for managed decodes.
256public const Int32 DefaultMaxAnimationDurationMs #Default maximum total animation duration (milliseconds) for managed decodes.
120000public const Int64 DefaultMaxAnimationFramePixels #Default maximum animation frame pixel count allowed for managed decodes.
50000000Events
public static event Action<ImageDecodeLimitViolation> LimitViolation #Optional handler invoked when decode limits are violated.