Class GifEncoder
Image encoder for writing image data to a stream in gif format.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Gif
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class GifEncoder : IImageEncoder
Properties
| Improve this Doc View SourceColorTableMode
Gets or sets the color table mode: Global or local.
Declaration
public GifColorTableMode? ColorTableMode { get; set; }
Property Value
Type | Description |
---|---|
Nullable<GifColorTableMode> |
GlobalPixelSamplingStrategy
Gets or sets the IPixelSamplingStrategy used for quantization when building a global color table in case of Global.
Declaration
public IPixelSamplingStrategy GlobalPixelSamplingStrategy { get; set; }
Property Value
Type | Description |
---|---|
IPixelSamplingStrategy |
Quantizer
Gets or sets the quantizer for reducing the color count. Defaults to the OctreeQuantizer
Declaration
public IQuantizer Quantizer { get; set; }
Property Value
Type | Description |
---|---|
IQuantizer |
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. |