Class TgaEncoder
Image encoder for writing an image to a stream as a targa truevision image.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Tga
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class TgaEncoder : IImageEncoder
Properties
| Improve this Doc View SourceBitsPerPixel
Gets or sets the number of bits per pixel.
Declaration
public TgaBitsPerPixel? BitsPerPixel { get; set; }
Property Value
Type | Description |
---|---|
Nullable<TgaBitsPerPixel> |
Compression
Gets or sets a value indicating whether no compression or run length compression should be used.
Declaration
public TgaCompression Compression { get; set; }
Property Value
Type | Description |
---|---|
TgaCompression |
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. |