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