Class JpegDecoder
- Namespace
- SixLabors.ImageSharp.Formats.Jpeg
- Assembly
- SixLabors.ImageSharp.dll
Decoder for generating an image out of a jpeg encoded stream.
public sealed class JpegDecoder : SpecializedImageDecoder<JpegDecoderOptions>, ISpecializedImageDecoder<JpegDecoderOptions>, IImageDecoder
- Inheritance
-
JpegDecoder
- Implements
- Inherited Members
Properties
Instance
Gets the shared instance.
public static JpegDecoder Instance { get; }
Property Value
Methods
CreateDefaultSpecializedOptions(DecoderOptions)
A factory method for creating the default specialized options.
protected override JpegDecoderOptions CreateDefaultSpecializedOptions(DecoderOptions options)
Parameters
optionsDecoderOptionsThe general decoder options.
Returns
- JpegDecoderOptions
The new JpegDecoderOptions.
Decode(JpegDecoderOptions, Stream, CancellationToken)
Decodes the image from the specified stream to an Image of a specific pixel type.
protected override Image Decode(JpegDecoderOptions options, Stream stream, CancellationToken cancellationToken)
Parameters
optionsJpegDecoderOptionsThe specialized decoder options.
streamStreamThe Stream containing image data.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Image
The Image<TPixel>.
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
- 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.
protected override Image<TPixel> Decode<TPixel>(JpegDecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
optionsJpegDecoderOptionsThe specialized decoder options.
streamStreamThe Stream containing image data.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Image<TPixel>
The Image<TPixel>.
Type Parameters
TPixelThe pixel format.
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
- ImageFormatException
Thrown if the encoded image contains errors.
Identify(DecoderOptions, Stream, CancellationToken)
Reads the raw image information from the specified stream.
protected override ImageInfo Identify(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
Parameters
optionsDecoderOptionsThe general decoder options.
streamStreamThe Stream containing image data.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.
Exceptions
- ImageFormatException
Thrown if the encoded image contains errors.