aspose.info
EN

TGA File Format - A TARGA Graphic Image File

Updated

What is a TGA file?

A file with .tga extension is a raster graphic format and was created by Truevision Inc. It was designed for the TARGA (Truevision Advanced Raster Adapter) boards and provided Highcolor/truecolor display support for IBM-compatible PCs. It supports 8, 16, 24 and 32 bits per pixel and 8-bit alpha channel. It also supports lossless RLE compression that can be applied to reduce the image size. Digital photos and textures use the TGA image format.

Brief History

Formation of TGA file format came into being in 1984 by AT&T EPICenter (later extracted and formed as an independent entity known as Truevision) that was working on marketing of new technologies developed by AT&T for color frame buffers. EPICenter was already working on its first two cards, the VDA (Video Display Adapter) and ICB (image capture board) for which work on two file types, .vda and .icb, was already in process. These file formats were codified and less broad specific file format TGA was introduced. TGA was an extension to what was already in use, and provided information such as width, height, pixel depth, associated color map and image origin.

TGA’s 2.0 version, published in 1989, incorporated several enhanced features such as:

  • Thumbnails
  • Alpha channel
  • Gamma Value
  • Textual Metadata

Prime contributors to TGA’s 2.0 version include Truevision’s Shawn Steiner, Kevin Fiedly and David Spoelstra.

TGA TARGA File Format Specifications

A TGA file consists of 2 main parts:

  • Header
  • Colour Pixel information

All the values in a TGA file are in littl-endian as per the format specifications.

TGA Header

A TGA file header consists of the following 5 fields.

Field no.LengthField nameDescription
11 byteID lengthLength of the image ID field (0-255)
21 byteColor map typeWhether a color map is included (0 - indicates that no color-map data is included with this image. 1 - indicates that a color-map is included with this image.)
31 byteImage typeCompression and color types (0- No Image Data Included. 1- Uncompressed, Color mapped image, 2- Uncompressed, True Color Image, 9- Run-length encoded, Color mapped image, 11- Run-Length encoded, Black and white image)
45 bytesColor map specificationDescribes the color map
510 bytesImage specificationImage dimensions and format

Image and Color Map Data

Field no.LengthFieldDescription
6From image ID length fieldImage IDOptional field containing identifying information
7From color map specification fieldColor map dataLook-up table containing color map data
8From image specification fieldImage dataStored according to the image descriptor

Developer Area (Optional)

TGA Version 2.0 provides support for additional enhancements/extras which many developers wanted to store more information. The information is optional so that if a TGA decoder is not able to interpret it, it will be ignored.

Extension Area (Optional)

Field no.LengthFieldDescription
102 bytesExtension sizeSize in bytes of the extension area, always 495
1141 bytesAuthor nameName of the author. If not used, bytes should be set to NULL (\0) or spaces
12324 bytesAuthor commentA comment, organized as four lines, each consisting of 80 characters plus a NULL
1312 bytesDate/time stampDate and time at which the image was created
1441 bytesJob ID
156 bytesJob timeHours, minutes and seconds spent creating the file (for billing, etc.)
1641 bytesSoftware IDThe application that created the file.
173 bytesSoftware version
184 bytesKey color
194 bytesPixel aspect ratio
204 bytesGamma value
214 bytesColor correction offsetNumber of bytes from the beginning of the file to the color correction table if present
224 bytesPostage stampNumber of bytes from the beginning of the file to the postage stamp image if present
234 bytesScan line offsetNumber of bytes from the beginning of the file to the scan lines table if present
241 byteAttributes typeSpecifies the alpha channel

The last 26 bytes of the file represent the footer, which if present means its likely a TGA version 2 file.

Field No.LengthFieldDescription
284 bytesExtension offsetOffset in bytes from the beginning of the file
294 bytesDeveloper area offsetOffset in bytes from the beginning of the file
3016 bytesSignatureContains “TRUEVISION-XFILE”
311 byteContains “.”
321 byteContains NULL

References

See also