Targa Image File
Targa Image File | |
---|---|
File extension : |
.tga, .tpic
|
MIME type : | image / x-targa image / x-tga |
Developed by: | Truevision |
Type: | Graphics file |
The Targa Image File Format (TGA for short, common file extension:) .tga
is a file format for storing images. Targa stands for "Truevision Advanced Raster Graphics Array".
The Targa file format was originally developed in 1984 by the Truevision company. In 1989 it was expanded to include thumbnails , values for alpha channel , gamma correction and text as meta information .
The data is saved with up to 32 bits per pixel as a raster graphic ( bitmap ) either uncompressed or compressed with a run-length coding without loss.
specification
format | .tga |
Possible color depths (in bit) | 8, 24, 32 |
Alpha channel | Yes (one) |
Levels | No |
Compression | Possible |
Lossy | No |
ICC profile | No |
Paths | No |
All data is saved in little-endian format . The TGA format is structured as follows, where a word consists of 16 bits:
element | Data type / size | description | |
---|---|---|---|
File header | Length of the picture ID | 1 byte | if the value is 0, the image ID is omitted |
Color palette type | 1 byte | 0 = no color palette 1 = color palette available |
|
Image type | 1 byte | 0 = no image data 1 = indexed (color palette) uncompressed 2 = RGB (24 or 32 bit) uncompressed 3 = monochrome uncompressed 9 = indexed (color palette) run length coded 10 = RGB (24 bit) run length coded 11 = monochrome run length coded |
|
Start of pallet | 1 word | The default is 0 | |
Pallet length | 1 word | Number of colors in the palette | |
Size (in bits) of a pallet entry | 1 byte | typical values are 15, 16, 24 and 32 | |
X coordinate for zero point | 1 word | The default is 0 | |
Y coordinate for zero point | 1 word | The default is 0 | |
Image width | 1 word | ||
Image height | 1 word | ||
Bits per pixel | 1 byte | valid values are 1, 8, 15, 16, 24, and 32 | |
Image attribute byte | 1 byte | Bits 0-3: Number of attribute bits per pixel Bit 4: horizontal position of the zero point (0 = left, 1 = right) Bit 5: vertical position of the zero point (0 = bottom, 1 = top) Bit 6-7: 0 |
|
Image ID (optional) |
0-255 bytes | Image identifier | |
Color palette (optional) |
0-8192 bytes | Pallet data sequence of the elements: BGR or BGRA |
|
Image data (theoretically optional) |
variable | Image data with run length coding or uncompressed | |
Developer area 1 | variable | Data according to the developer directory | |
Developer Directory 2 | Number of entries | 1 word | |
ID | 1 word | Values from 32768-65535 are reserved | |
Offset | 1 double word | Data position in the developer area (based on the start of the file) | |
size | 1 double word | Size of the developer field in bytes | |
further directory entries (10 bytes each) |
|||
Meta information 2 | Size of the area | 1 word | Value: 495 |
Author name | 41 bytes | null-terminated character string (max. 40 characters) |
|
Author comment | 324 bytes | 4 zero-terminated character strings (max. 80 characters each) |
|
Timestamp month | 1 word | ||
Timestamp day | 1 word | ||
Timestamp year | 1 word | ||
Timestamp hour | 1 word | ||
Time stamp minute | 1 word | ||
Timestamp second | 1 word | ||
Job name | 41 bytes | null-terminated character string (max. 40 characters) |
|
Job hour | 1 word | ||
Job minute | 1 word | ||
Job second | 1 word | ||
Software ID | 41 bytes | null-terminated character string (max. 40 characters) |
|
Version number | 1 word | Version number * 100 | |
Software version | 1 byte | Additional characters for the version number | |
Background color | 1 double word | The default is 0, corresponds to the transparency color | |
Pixel aspect ratio | 1 word | Counter of fraction | |
Pixel aspect ratio | 1 word | Denominator of the fraction | |
Gamma value | 1 word | Counter of fraction | |
Gamma value | 1 word | Denominator of the fraction | |
Offset of the color correction table | 1 double word | Offset (related to the beginning of the file) (0 = not available) |
|
Offset of the thumbnail | 1 double word | Offset (related to the beginning of the file) (0 = not available) |
|
Scan line table offset | 1 double word | Offset (related to the beginning of the file) (0 = not available) |
|
Attribute byte | 1 byte | 0 = no attribute data available 1 = undefined attribute data, can be ignored 2 = undefined attribute data, but should be kept 3 = attribute data available 4 = pre-multiplied attribute 5 - 127 = reserved 128 - 255 = unused |
|
Scan line table 3 | Image height * 1 double word | an offset per image line (based on the beginning of the file) | |
Thumbnail 3 | width | 1 byte | Width of the thumbnail (max. 64 pixels) |
height | 1 byte | Height of the thumbnail (max. 64 pixels) | |
Image data | variable | Format corresponds to the possibly uncompressed original image | |
Color Correction Table 3 | 256 * 4 words | ABGR correction values for the color palette entries | |
File foot 4 | Offset of the meta information | 1 double word | Offset (related to the beginning of the file) (0 = not available) |
Developer directory offset | 1 double word | Offset (related to the beginning of the file) (0 = not available) |
|
Signature for version 2.0 | 18 bytes | null-terminated character string "TRUEVISION-XFILE." |
Notes:
1 optional from version 2.0, developer directory and file footer required
2 optional from version 2.0, file footer required
3 optional from version 2.0, meta information and file footer required
4 optional from version 2.0 (if available, always the last 26 bytes)
Due to the offset information, the areas of version 2.0 do not necessarily have to border one another after the image data. Furthermore, although the order of the areas is defined as indicated, other arrangements are also possible due to the offset information.
Run length coding
With run length coding, each set of picture elements is led line by line by an additional control byte. If the 8th bit of this control byte is set, it is a repetition counter, the value of which results from the lower 7 bits increased by 1. The following pixel is repeated accordingly often. If the 8th bit of the control byte is 0, it is a data counter, the value of which also results from the lower 7 bits increased by 1. It indicates how many pixels follow in this block before a control byte occurs again. These pixels are taken over 1: 1.
application
The TGA format was widely used in the game industry. A well-known example of the use of images in TGA format is id Software . The company's early publications used this format. The advantage lies in the alpha channel, which is not supported by the BMP format. In addition, there is the possibility of lossless run length coding, which, however, saves less storage space than z. B. the barely visible compression of a JPG file. In the meantime, however, the TGA format has been almost completely replaced in this area by newer alternatives such as the DirectDraw Surface (DDS) format.
The format is also of great importance in the TV graphics sector. It was originally developed for the first Targa video graphics cards and is now something like the lowest common denominator of graphics formats. Every animation program and every font generator can process Targa files. The format offers maximum quality, as it is either not compressed at all or compressed without loss; In addition, thanks to the support of an alpha channel, it is ideal for creating graphics that are to be superimposed on a video.
distribution
The Targa Image File format has not managed to prevail over TIFF and other known formats, especially in the area of image processing . Targa offers too few options for compression , alpha channels, etc. and only a few image processing supports the format.
program | read | write |
---|---|---|
Adobe Photoshop | Yes | Yes |
Corel PaintShop Pro | Yes | Yes |
Corel Photo-Paint | Yes | Yes |
GIMP | Yes | Yes |
Paint.NET | Yes | Yes |
PaintTool SAI | Yes | Yes |
PhotoFiltre | Yes | o.A. |
POV-Ray | No | Yes |
IrfanView | Yes | Yes |
Affinity Designer | Yes | o.A. |
(As of April 2012)
At the same time TGA is one of the bitmap formats that the popular animation program Adobe Flash can import and use, for example .