TGA
From GPWiki
The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server. However, the GPWiki forums are still active! Come say hello. This page is far from complete, go ahead and write some more!
You can extend this page by editing it. The Targa or TGA format was developed in the mid-1980s by Truevision,Inc for their graphics hardware. The format supports both palletised and RGB colour up to 24 bits per pixel. 8-bit alpha channels are also supported along with RLE compression. The format was revised in the late 80s and now has optional extensions including embedded thumbnails, gamma values and numerous text fields. The TGA format is the file format which GLFW's image loading functions support. [edit] File FormatThe TGA Header is normally 18 bytes long:
BYTE ITEM SIZE DESCRIPTION
**** **** **** ***********
0 Offset 1 Usually 0,
add 18 to this value to find the start of the palette/image data.
1 ColorType 1 Image type. 0 = RGB, 1 = Indexed.
2 ImageType 1 0 = None, 1 = Indexed, 2 = RGB, 3 = Greyscale,
+8 = RLE encoded.
3 PaletteStart 2 Start of palette.
5 PaletteLen 2 Number of palette entries.
7 PalBits 1 Bits per colour entry.
8 X Origin 2 Image X Origin
10 Y Origin 2 Image Y Origin
12 Width 2 Image width (Pixels).
14 Height 2 Image height (Pixels)
16 BPP 1 Bits per pixel (8,16,24 or 32)
17 Orientation 1 If Bit 5 is set, the image will be upside down (like BMP)
Palette data for indexed images is normally stored directly after the header, but check the first byte of the header just to be sure. Image data follows the palette if present. v2 Files end with the null terminated string "TRUEVISION-XFILE." and have addtional data stored in areas referenced by the 8 bytes preceeding the signature string. [edit] Tutorials and source code[edit] External Links |


