Introduction
TGA, also called TARGA, is a raster image format made by Truevision in the 1980s for its TARGA and VISTA graphics cards. It stores palette, truecolour or greyscale images, either raw or with simple run-length compression.
Its simple layout and support for an alpha channel made it a long-standing choice for textures in games and 3D software, where it is still common.
Structure
A TGA file has no signature at the start. It opens with an 18-byte little-endian header: the length of an optional image ID, whether there is a colour map, the image type, the colour map's layout, then the image's origin, width, height, bits per pixel and a descriptor byte. The descriptor gives the number of alpha bits and whether rows run from the bottom up or the top down.
The image type is 1 for colour-mapped, 2 for truecolour and 3 for greyscale, with 8
added for the run-length encoded versions (9, 10 and 11). Version 2.0 of the format
adds an extension area, a developer area and a 26-byte footer that ends with the text
TRUEVISION-XFILE. and a zero byte.
0Header ID length, colour map type, image type, colour map spec, image spec18 bytes18Image ID optional free text0 to 255 bytes…Colour map the palette, when there is onevaries…Image data the pixels, raw or run-length encodedvaries…Footer version 2.0 only, endsTRUEVISION-XFILE.26 bytes
Links
Software
- GIMP (Windows, macOS, Linux)
- Adobe Photoshop (Windows, macOS)
- Krita (Windows, macOS, Linux)
- IrfanView (Windows)
- XnView MP (Windows, macOS, Linux)
- ImageMagick (Windows, macOS, Linux)
- Blender (Windows, macOS, Linux)