TgaEncoder Class

Immutable settings for TGA encoding (Truevision TGA 2.0 true-color and grayscale still images).

public sealed class TgaEncoder : ImageEncoder

Remarks

The output is the conservative true-color and grayscale subset: bottom-up rows with the origin at the bottom left, no image identification field, no color map, and a TGA 2.0 footer with no developer or extension area. Gray pixel formats are written as 8-bit grayscale (image type 3 or 11), pixel formats with alpha as 32-bit BGRA with 8 declared alpha bits, and the others as 24-bit BGR (image type 2 or 10). Color-mapped output, 15/16-bit output, right-to-left storage and top-down storage are never written.

The output is lossless for 8-bit pixels, alpha included; 16-bit pixel formats require TgaEncoder.AllowBitDepthReduction.

TGA stores exactly one frame: animated images and images with a poster frame are rejected with an UnsupportedImageFeatureException; use ImageFrame.Save to save one frame explicitly.

TGA stores no metadata this version writes: an ICC profile, EXIF, XMP, an orientation other than ExifOrientation.TopLeft, a resolution and text entries follow ImageEncoder.MetadataHandling (rejected by default).

Inheritance
ImageEncoder TgaEncoder

Constructors

NameDescription
TgaEncoder()

TgaEncoder()

public TgaEncoder()

No documentation is available.

Properties

NameDescription
AllowBitDepthReductionGets a value indicating whether 16-bit pixel formats may be reduced to 8 bits per component (nearest rounding). Defaults to false.
CompressionGets the compression. Defaults to TgaCompression.None.
FormatGets the format produced by this encoder.

AllowBitDepthReduction

TgaEncoder.cs

Gets a value indicating whether 16-bit pixel formats may be reduced to 8 bits per component (nearest rounding). Defaults to false.

public bool AllowBitDepthReduction { get; init; }

Property value

bool

Compression

TgaEncoder.cs

Gets the compression. Defaults to TgaCompression.None.

public TgaCompression Compression { get; init; }

Property value

TgaCompression

Exceptions

ArgumentOutOfRangeException
The value is not a defined TgaCompression.

Gets the format produced by this encoder.

public override ImageFormat Format { get; }

Property value

ImageFormat