Class PngDecoder
Decoder for generating an image out of a png encoded stream.
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Png
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class PngDecoder : SpecializedImageDecoder<PngDecoderOptions>, ISpecializedImageDecoder<PngDecoderOptions>, IImageDecoder
Properties
| Edit this page View SourceInstance
Gets the shared instance.
Declaration
public static PngDecoder Instance { get; }
Property Value
Type | Description |
---|---|
PngDecoder |
Methods
| Edit this page View SourceCreateDefaultSpecializedOptions(DecoderOptions)
A factory method for creating the default specialized options.
Declaration
protected override PngDecoderOptions CreateDefaultSpecializedOptions(DecoderOptions options)
Parameters
Type | Name | Description |
---|---|---|
DecoderOptions | options | The general decoder options. |
Returns
Type | Description |
---|---|
PngDecoderOptions | The new PngDecoderOptions. |
Overrides
| Edit this page View SourceDecode(PngDecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image of a specific pixel type.
Declaration
protected override Image Decode(PngDecoderOptions options, Stream stream, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
PngDecoderOptions | 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>(PngDecoderOptions, 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>(PngDecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
PngDecoderOptions | 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. |