Class BmpEncoder
Image encoder for writing an image to a stream as a Windows bitmap.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Bmp
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class BmpEncoder : QuantizingImageEncoder, IImageEncoder
Constructors
| Edit this page View SourceBmpEncoder()
Initializes a new instance of the BmpEncoder class.
Declaration
public BmpEncoder()
Properties
| Edit this page View SourceBitsPerPixel
Gets the number of bits per pixel.
Declaration
public BmpBitsPerPixel? BitsPerPixel { get; init; }
Property Value
Type | Description |
---|---|
BmpBitsPerPixel? |
SupportTransparency
Gets a value indicating whether the encoder should support transparency. Note: Transparency support only works together with 32 bits per pixel. This option will change the default behavior of the encoder of writing a bitmap version 3 info header with no compression. Instead a bitmap version 4 info header will be written with the BITFIELDS compression.
Declaration
public bool SupportTransparency { get; init; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceEncode<TPixel>(Image<TPixel>, Stream, CancellationToken)
Encodes the image to the specified stream from the Image<TPixel>.
Declaration
protected override void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
Image<TPixel> | image | The Image<TPixel> to encode from. |
Stream | stream | The Stream to encode the image data to. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
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.