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 : IImageEncoder
Properties
| Improve this Doc View SourceBitsPerPixel
Gets or sets the number of bits per pixel.
Declaration
public BmpBitsPerPixel? BitsPerPixel { get; set; }
Property Value
Type | Description |
---|---|
Nullable<BmpBitsPerPixel> |
Quantizer
Gets or sets the quantizer for reducing the color count for 8-Bit images. Defaults to Wu Quantizer.
Declaration
public IQuantizer Quantizer { get; set; }
Property Value
Type | Description |
---|---|
IQuantizer |
SupportTransparency
Gets or sets 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; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceEncode<TPixel>(Image<TPixel>, Stream)
Encodes the image to the specified stream from the Image<TPixel>.
Declaration
public void Encode<TPixel>(Image<TPixel> image, Stream stream)
where TPixel : struct, 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. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
EncodeAsync<TPixel>(Image<TPixel>, Stream, CancellationToken)
Encodes the image to the specified stream from the Image<TPixel>.
Declaration
public Task EncodeAsync<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken)
where TPixel : struct, 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. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |