Interface IImageDecoder
Defines the contract for all image decoders.
Namespace: SixLabors.ImageSharp.Formats
Assembly: SixLabors.ImageSharp.dll
Syntax
public interface IImageDecoder
Methods
| Edit this page View SourceDecode(DecoderOptions, Stream)
Decodes the image from the specified stream to an Image of a specific pixel type.
Declaration
Image Decode(DecoderOptions options, Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderOptions | options | The general decoder options. |
| Stream | stream | The Stream containing image data. |
Returns
| Type | Description |
|---|---|
| Image | The Image<TPixel>. |
Exceptions
| Type | Condition |
|---|---|
| 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.
Declaration
Task<Image> DecodeAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderOptions | options | The general decoder options. |
| Stream | stream | The Stream containing image data. |
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<Image> | A Task<TResult> representing the asynchronous operation. |
Exceptions
| Type | Condition |
|---|---|
| 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.
Declaration
Task<Image<TPixel>> DecodeAsync<TPixel>(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default) where TPixel : unmanaged, IPixel<TPixel>
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderOptions | options | The general decoder options. |
| Stream | stream | The Stream containing image data. |
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<Image<TPixel>> | A Task<TResult> representing the asynchronous operation. |
Type Parameters
| Name | Description |
|---|---|
| TPixel | The pixel format. |
Exceptions
| Type | Condition |
|---|---|
| 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.
Declaration
Image<TPixel> Decode<TPixel>(DecoderOptions options, Stream stream) where TPixel : unmanaged, IPixel<TPixel>
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderOptions | options | The general decoder options. |
| Stream | stream | The Stream containing image data. |
Returns
| Type | Description |
|---|---|
| Image<TPixel> | The Image<TPixel>. |
Type Parameters
| Name | Description |
|---|---|
| TPixel | The pixel format. |
Exceptions
| Type | Condition |
|---|---|
| ImageFormatException | Thrown if the encoded image contains errors. |
Identify(DecoderOptions, Stream)
Reads the raw image information from the specified stream.
Declaration
ImageInfo Identify(DecoderOptions options, Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderOptions | options | The general decoder options. |
| Stream | stream | The Stream containing image data. |
Returns
| Type | Description |
|---|---|
| ImageInfo | The ImageInfo object. |
Exceptions
| Type | Condition |
|---|---|
| ImageFormatException | Thrown if the encoded image contains errors. |
IdentifyAsync(DecoderOptions, Stream, CancellationToken)
Reads the raw image information from the specified stream.
Declaration
Task<ImageInfo> IdentifyAsync(DecoderOptions options, Stream stream, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderOptions | options | The general decoder options. |
| Stream | stream | The Stream containing image data. |
| CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<ImageInfo> | The Task<TResult> object. |
Exceptions
| Type | Condition |
|---|---|
| ImageFormatException | Thrown if the encoded image contains errors. |