Truevision TGA is a raster graphics file format created by Truevision.
TGA files are currently used as the standard image transfer format between Varvara and the host operating system.
|1 byte||ID length||Length of the image ID field|
|1 byte||Color map type||Whether a color map is included|
|1 byte||Image type||Compression and color types|
|5 bytes||Color map specification||Describes the color map|
|2 bytes||X-origin||absolute x of lower-left corner|
|2 bytes||Y-origin||absolute y of lower-left corner|
|2 bytes||Image width||width in pixels|
|2 bytes||Image height||height in pixels|
|1 byte||Pixel depth||bits per pixel|
|1 byte||Image descriptor||bits 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
- 0 if image file contains no color map
- 1 if present
- 2–127 reserved by Truevision
- 128–255 available for developer use
Enumerated in the lower three bits, with the fourth bit as a flag for RLE. Some possible values are:
- 0 no image data is present
- 1 uncompressed color-mapped image
- 2 uncompressed true-color image
- 3 uncompressed black-and-white (grayscale) image
- 9 run-length encoded color-mapped image
- 10 run-length encoded true-color image
- 11 run-length encoded black-and-white (grayscale) image
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
- First entry index (2 bytes): index of first color map entry that is included in the file
- Color map length (2 bytes): number of entries of the color map that are included in the file
- Color map entry size (1 byte): number of bits per pixel
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.
Incoming: noodle adelie dito chr format