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
optionsDecoderOptionsThe general decoder options.
streamStreamThe 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
optionsDecoderOptionsThe general decoder options.
streamStreamThe Stream containing image data.
cancellationTokenCancellationTokenThe 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
optionsDecoderOptionsThe general decoder options.
streamStreamThe Stream containing image data.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task<Image<TPixel>>
A Task<TResult> representing the asynchronous operation.
Type Parameters
TPixelThe 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
optionsDecoderOptionsThe general decoder options.
streamStreamThe Stream containing image data.
Returns
- Image<TPixel>
The Image<TPixel>.
Type Parameters
TPixelThe 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
optionsDecoderOptionsThe general decoder options.
streamStreamThe Stream containing image data.
Returns
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
optionsDecoderOptionsThe general decoder options.
streamStreamThe Stream containing image data.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task<ImageInfo>
The Task<TResult> object.
Exceptions
- ImageFormatException
Thrown if the encoded image contains errors.