Class WebpDecoder
Image decoder for generating an image out of a webp stream.
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Webp
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class WebpDecoder : SpecializedImageDecoder<WebpDecoderOptions>, ISpecializedImageDecoder<WebpDecoderOptions>, IImageDecoder
Properties
| Edit this page View SourceInstance
Gets the shared instance.
Declaration
public static WebpDecoder Instance { get; }
Property Value
Type | Description |
---|---|
WebpDecoder |
Methods
| Edit this page View SourceCreateDefaultSpecializedOptions(DecoderOptions)
A factory method for creating the default specialized options.
Declaration
protected override WebpDecoderOptions CreateDefaultSpecializedOptions(DecoderOptions options)
Parameters
Type | Name | Description |
---|---|---|
DecoderOptions | options | The general decoder options. |
Returns
Type | Description |
---|---|
WebpDecoderOptions | The new WebpDecoderOptions. |
Overrides
| Edit this page View SourceDecode(DecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image.
Declaration
protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
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 |
---|---|
Image | The Image. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode(WebpDecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image of a specific pixel type.
Declaration
protected override Image Decode(WebpDecoderOptions options, Stream stream, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
WebpDecoderOptions | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Image | The Image<TPixel>. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Decode<TPixel>(WebpDecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.
Declaration
protected override Image<TPixel> Decode<TPixel>(WebpDecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
WebpDecoderOptions | options | The specialized decoder options. |
Stream | stream | The Stream containing image data. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Image<TPixel> | The Image<TPixel>. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |
Identify(DecoderOptions, Stream, CancellationToken)
Reads the raw image information from the specified stream.
Declaration
protected override ImageInfo Identify(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
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 |
---|---|
ImageInfo | The ImageInfo object. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
Type | Condition |
---|---|
ImageFormatException | Thrown if the encoded image contains errors. |