Truevision TGA is a raster graphics file format created by Truevision.

TGA are the current image transfer format between Varvara and the host operating system.

LengthField nameDescription
1 byteID lengthLength of the image ID field
1 byteColor map typeWhether a color map is included
1 byteImage typeCompression and color types
5 bytesColor map specificationDescribes the color map
2 bytesX-originabsolute x of lower-left corner
2 bytesY-originabsolute y of lower-left corner
2 bytesImage widthwidth in pixels
2 bytesImage heightheight in pixels
1 bytePixel depthbits per pixel
1 byteImage descriptorbits 3-0 give the alpha channel depth, bits 5-4 give direction

Image ID length

0–255 The number of bytes that the image ID field consists of. The image ID field can contain any information, but it is common for it to contain the date and time the image was created or a serial number.

Color map type

Image type

Enumerated in the lower three bits, with the fourth bit as a flag for RLE. Some possible values are:

Image type 1 and 9: Depending on the Pixel Depth value, image data representation is an 8, 15, or 16 bit index into a color map that defines the color of the pixel. Image type 2 and 10: The image data is a direct representation of the pixel color. For a Pixel Depth of 15 and 16 bit, each pixel is stored with 5 bits per color. If the pixel depth is 16 bits, the topmost bit is reserved for transparency. For a pixel depth of 24 bits, each pixel is stored with 8 bits per color. A 32-bit pixel depth defines an additional 8-bit alpha channel. Image type 3 and 11: The image data is a direct representation of grayscale data. The pixel depth is 8 bits for images of this type.

Color map specification

In case that not the entire color map is actually used by the image, a non-zero first entry index allows to store only a required part of the color map in the file.