Table of Contents

Enum TgaPixelFormat

Namespace
Egami.Formats.Tga
Assembly
Egami.dll

The pixel layout a TGA is written with.

public enum TgaPixelFormat

Fields

Auto = 0

8-bit gray for gray types without alpha, 24-bit when every pixel is opaque, else 32-bit with alpha.

Bgr24 = 3

24-bit blue, green and red. Alpha is dropped, not blended onto a background.

Bgr555 = 5

16-bit 5-5-5 blue, green and red, with no attribute bits. Alpha is dropped.

Bgra32 = 4

32-bit blue, green, red and alpha.

Bgra5551 = 6

16-bit 5-5-5 blue, green and red and one attribute bit of alpha: 128 and above is opaque.

Gray8 = 1

8-bit gray (image type 3).

Indexed8 = 2

8-bit indices into a color map of up to 256 colors, with alpha in the map when the image has any.

Examples

image.Save("duck-gray.tga", new TgaWriterOptions { PixelFormat = TgaPixelFormat.Gray8, Rle = false });
using Raster back = Raster.Load("duck-gray.tga");
TgaDetails details = (TgaDetails)back.Metadata.FormatDetails!;
bool upsideDown = details.Origin is TgaOrigin.BottomLeft or TgaOrigin.BottomRight;
bool hasAlpha = details.AlphaType is TgaAlphaType.Straight or TgaAlphaType.Premultiplied;