Table of Contents

Class BmpDecoder

Namespace
SixLabors.ImageSharp.Formats.Bmp
Assembly
SixLabors.ImageSharp.dll

Image decoder for generating an image out of a Windows bitmap stream.

public sealed class BmpDecoder : SpecializedImageDecoder<BmpDecoderOptions>, ISpecializedImageDecoder<BmpDecoderOptions>, IImageDecoder
Inheritance
BmpDecoder
Implements
Inherited Members

Properties

Instance

Gets the shared instance.

public static BmpDecoder Instance { get; }

Property Value

BmpDecoder

Methods

CreateDefaultSpecializedOptions(DecoderOptions)

A factory method for creating the default specialized options.

protected override BmpDecoderOptions CreateDefaultSpecializedOptions(DecoderOptions options)

Parameters

options DecoderOptions

The general decoder options.

Returns

BmpDecoderOptions

The new BmpDecoderOptions.

Decode(BmpDecoderOptions, Stream, CancellationToken)

Decodes the image from the specified stream to an Image of a specific pixel type.

protected override Image Decode(BmpDecoderOptions options, Stream stream, CancellationToken cancellationToken)

Parameters

options BmpDecoderOptions

The specialized decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The 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>(BmpDecoderOptions, Stream, CancellationToken)

Decodes the image from the specified stream to an Image<TPixel> of a specific pixel type.

protected override Image<TPixel> Decode<TPixel>(BmpDecoderOptions options, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>

Parameters

options BmpDecoderOptions

The specialized decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Image<TPixel>

The Image<TPixel>.

Type Parameters

TPixel

The 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

options DecoderOptions

The general decoder options.

stream Stream

The Stream containing image data.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

ImageInfo

The ImageInfo object.

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.