Table of Contents

Interface IImageDecoder

Namespace
SixLabors.ImageSharp.Formats
Assembly
SixLabors.ImageSharp.dll

Defines the contract for all image decoders.

public interface IImageDecoder

Methods

Decode(DecoderOptions, Stream)

Decodes the image from the specified stream to an Image of a specific pixel type.

Image Decode(DecoderOptions options, Stream stream)

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

Returns

Image

The Image<TPixel>.

Exceptions

ImageFormatException

Thrown if the encoded image contains errors.

DecodeAsync(DecoderOptions, Stream, CancellationToken)

Decodes the image from the specified stream to an Image of a specific pixel type.

Task<Image> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<Image>

A Task<TResult> representing the asynchronous operation.

Exceptions

ImageFormatException

Thrown if the encoded image contains errors.

DecodeAsync<TPixel>(DecoderOptions, Stream, CancellationToken)

Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.

Task<Image<TPixel>> DecodeAsync<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<Image<TPixel>>

A Task<TResult> representing the asynchronous operation.

Type Parameters

TPixel

The pixel format.

Exceptions

ImageFormatException

Thrown if the encoded image contains errors.

Decode<TPixel>(DecoderOptions, Stream)

Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.

Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

Returns

Image<TPixel>

The Image<TPixel>.

Type Parameters

TPixel

The pixel format.

Exceptions

ImageFormatException

Thrown if the encoded image contains errors.

Identify(DecoderOptions, Stream)

Reads the raw image information from the specified stream.

ImageInfo Identify(DecoderOptions options, Stream stream)

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

Returns

ImageInfo

The ImageInfo object.

Exceptions

ImageFormatException

Thrown if the encoded image contains errors.

IdentifyAsync(DecoderOptions, Stream, CancellationToken)

Reads the raw image information from the specified stream.

Task<ImageInfo> IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)

Parameters

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<ImageInfo>

The Task<TResult> object.

Exceptions

ImageFormatException

Thrown if the encoded image contains errors.