API Reference
ImageReader
Auto-detects common image formats and decodes to RGBA buffers.
Inheritance
- Object
- ImageReader
Methods
public static ImageAnimationFrame[] DecodeAnimationCanvasFrames(Stream stream, 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(Stream stream, 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@
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}
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
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}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
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
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
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
- 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) (auto-detected).
Parameters
- data System.Byte[]
- 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) (auto-detected) with decode options.
Parameters
- data System.Byte[]
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
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}
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
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}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
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
- width System.Int32@
- height System.Int32@
- options CodeGlyphX.Rendering.ImageAnimationOptions@
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
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
- animationOptions CodeGlyphX.Rendering.ImageAnimationOptions@
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.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
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[]
- 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.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
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[]
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
public static Byte[] DecodeRgba32(Stream stream, 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(Stream stream, Int32 pageIndex, 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@
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[]
- pageIndex System.Int32
- width System.Int32@
- height System.Int32@
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}
- width System.Int32@
- height System.Int32@
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}
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
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}
- pageIndex System.Int32
- width System.Int32@
- height System.Int32@
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
- width System.Int32@
- height System.Int32@
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
- options CodeGlyphX.ImageDecodeOptions
- width System.Int32@
- height System.Int32@
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
- pageIndex System.Int32
- width System.Int32@
- height System.Int32@
public static Byte[] DecodeRgba32Composite(Stream stream, 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(Stream stream, 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);
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}
- width System.Int32@
- height System.Int32@
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}
- 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);
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
- width System.Int32@
- height System.Int32@
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
- 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 Byte[] DecodeRgba32Safe(Stream stream, out Int32 width, out Int32 height) #Byte[]Decodes an image to an RGBA buffer (auto-detected) using safe defaults for untrusted inputs.
Parameters
- data System.Byte[]
- width System.Int32@
- height System.Int32@
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
- width System.Int32@
- height System.Int32@
public static TiffRgba32Page[] DecodeTiffPagesRgba32(ReadOnlySpan<Byte> data) #TiffRgba32Page[]Decodes all TIFF pages into RGBA32 buffers.
Parameters
- data System.Byte[]
DecodeTiffPagesRgba32(System.IO.Stream stream) #Decodes all TIFF pages into RGBA32 buffers.
Parameters
- stream System.IO.Stream
DecodeTiffPagesRgba32(System.ReadOnlySpan{System.Byte} data) #Decodes all TIFF pages into RGBA32 buffers.
Parameters
- data System.ReadOnlySpan{System.Byte}
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.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
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[]
- 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.ReadOnlySpan{System.Byte}
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
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[]
- 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(Stream stream, 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@
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}
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
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
- 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 into RGBA32 buffers.
Parameters
- data System.Byte[]
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
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}
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
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
- frames CodeGlyphX.Rendering.Gif.GifAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Gif.GifAnimationOptions@
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.Byte[]
- 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 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@
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
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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}
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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}
- options CodeGlyphX.ImageDecodeOptions
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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}
- pageIndex System.Int32
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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.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.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}\");
}
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
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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
- 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}\");
}
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}
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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}
- 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 TryDecodeRgba32Safe(Stream stream, out Byte[] rgba, out Int32 width, out Int32 height) #BooleanAttempts to decode an image to an RGBA buffer (auto-detected) using safe defaults for untrusted inputs.
Parameters
- data System.Byte[]
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
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
- rgba System.Byte[]@
- width System.Int32@
- height System.Int32@
public static Boolean TryDecodeTiffPagesRgba32(Stream stream, out TiffRgba32Page[] pages) #BooleanAttempts to decode all TIFF pages into RGBA32 buffers.
Parameters
- data System.Byte[]
- pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@
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}
- pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@
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
- pages CodeGlyphX.Rendering.Tiff.TiffRgba32Page[]@
public static Boolean TryDecodeWebpAnimationCanvasFrames(Stream stream, 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@
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}
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
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
- 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 into RGBA32 buffers.
Parameters
- data System.Byte[]
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
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}
- frames CodeGlyphX.Rendering.Webp.WebpAnimationFrame[]@
- canvasWidth System.Int32@
- canvasHeight System.Int32@
- options CodeGlyphX.Rendering.Webp.WebpAnimationOptions@
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
- 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(Stream stream, out ImageAnimationInfo info) #BooleanAttempts to read animation format info without decoding pixels.
Parameters
- data System.Byte[]
- info CodeGlyphX.Rendering.ImageAnimationInfo@
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}
- info CodeGlyphX.Rendering.ImageAnimationInfo@
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
- info CodeGlyphX.Rendering.ImageAnimationInfo@
public static Boolean TryReadInfo(Stream stream, 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(Stream stream, 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@
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}
- info CodeGlyphX.Rendering.ImageInfo@
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}
- pageIndex System.Int32
- info CodeGlyphX.Rendering.ImageInfo@
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
- info CodeGlyphX.Rendering.ImageInfo@
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
- pageIndex System.Int32
- info CodeGlyphX.Rendering.ImageInfo@
public static Boolean TryReadPageCount(Stream stream, out Int32 pageCount) #BooleanAttempts to read page count for multipage images (TIFF).
Parameters
- data System.ReadOnlySpan{System.Byte}
- pageCount System.Int32@
TryReadPageCount(System.Byte[] data, System.Int32@ pageCount) #Attempts to read page count for multipage images (TIFF) from a byte buffer.
Parameters
- data System.Byte[]
- pageCount System.Int32@
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
- 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.