Enum TgaPixelFormat
The pixel layout a TGA is written with.
public enum TgaPixelFormat
Fields
Auto = 08-bit gray for gray types without alpha, 24-bit when every pixel is opaque, else 32-bit with alpha.
Bgr24 = 324-bit blue, green and red. Alpha is dropped, not blended onto a background.
Bgr555 = 516-bit 5-5-5 blue, green and red, with no attribute bits. Alpha is dropped.
Bgra32 = 432-bit blue, green, red and alpha.
Bgra5551 = 616-bit 5-5-5 blue, green and red and one attribute bit of alpha: 128 and above is opaque.
Gray8 = 18-bit gray (image type 3).
Indexed8 = 28-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;