This file has been created to satisfy numerous requests for information
on Targa image file formats. The information has been taken from
Appendix C of the Truevision Technical Guide. Requests for further
information could be directed to:
AT&T
Electronic Photography and Imaging Center
2002 Wellesley Ave.
Indianapolis, IN 42619
This document does not pretend to be complete, but it does pretend to
be accurate. If you discover any finger checks or erroneous information
please let me know, ( David McDuffee, 75530,2626), and I will upload the
corrections. Thanks.
The lack of completeness is due to the fact that the Targa recognizes
over half a dozen image file formats, some of which are more widely
used than others. I have chosen to re-key the details on only those
formats which I actually use. Again, if you want to know more about
formats not covered here, you could contact your Truevision representative.
All Targa formats are identified by a Data Type field, which is a one
byte binary integer located in byte three of the file. The various
file types specified by this field are as follows:
0 - No image data included.
1 - Uncompressed, color-mapped images.
2 - Uncompressed, RGB images.
3 - Uncompressed, black and white images.
9 - Runlength encoded color-mapped images.
10 - Runlength encoded RGB images.
11 - Compressed, black and white images.
32 - Compressed color-mapped data, using Huffman, Delta, and
runlength encoding.
33 - Compressed color-mapped data, using Huffman, Delta, and
runlength encoding. 4-pass quadtree-type process.
This document will describe only four formats: 1, 2, 9, and 10.
--------------------------------------------------------------------------------
DATA TYPE 1: Color-mapped images. |
_______________________________________________________________________________|
| Offset | Length | Description |
|--------|--------|------------------------------------------------------------|
|--------|--------|------------------------------------------------------------|
| 0 | 1 | Number of Characters in Identification Field. |
| | | |
| | | This field is a one-byte unsigned integer, specifying |
| | | the length of the Image Identification Field. Its range |
| | | is 0 to 255. A value of 0 means that no Image |
| | | Identification Field is included. |
| | | |
|--------|--------|------------------------------------------------------------|
| 1 | 1 | Color Map Type. |
| | | |
| | | This field contains a binary 1 for Data Type 1 images. |
| | | |
|--------|--------|------------------------------------------------------------|
| 2 | 1 | Image Type Code. |
| | | |
| | | This field will always contain a binary 1. |
| | | ( That's what makes it Data Type 1 ). |
| | | |
|--------|--------|------------------------------------------------------------|
| 3 | 5 | Color Map Specification. |
| | | |
| 3 | 2 | Color Map Origin. |
| | | Integer ( lo-hi ) index of first color map entry. |
| | | |
| 5 | 2 | Color Map Length. |
| | | Integer ( lo-hi ) count of color map entries. |
| | | |
| 7 | 1 | Color Map Entry Size. |
| | | Number of bits in each color map entry. 16 for |
| | | the Targa 16, 24 for the Targa 24, 32 for the Targa 32. |
| | | |
|--------|--------|------------------------------------------------------------|
| 8 | 10 | Image Specification. |
| | | |
| 8 | 2 | X Origin of Image. |
| | | Integer ( lo-hi ) X coordinate of the lower left corner |
| | | of the image. |
| | | |
| 10 | 2 | Y Origin of Image. |
| | | Integer ( lo-hi ) Y coordinate of the lower left corner |
| | | of the image. |
| | | |
| 12 | 2 | Width of Image. |
| | | Integer ( lo-hi ) width of the image in pixels. |
| | | |
| 14 | 2 | Height of Image. |
| | | Integer ( lo-hi ) height of the image in pixels. |
| | | |
| 16 | 1 | Image Pixel Size. |
| | | Number of bits in a stored pixel index. |
| | | |
| 17 | 1 | Image Descriptor Byte. |
| | | Bits 3-0 - number of attribute bits associated with each |
| | | pixel. |
| | | Bit 4 - reserved. Must be set to 0. |
| | | Bit 5 - screen origin bit. |
| | | 0 = Origin in lower left-hand corner. |
| | | 1 = Origin in upper left-hand corner. |
| | | Must be 0 for Truevision images. |
| | | Bits 7-6 - Data storage interleaving flag. |
| | | 00 = non-interleaved. |
| | | 01 = two-way (even/odd) interleaving. |
| | | 10 = four way interleaving. |
| | | 11 = reserved. |
| | | This entire byte should be set to 0. Don't ask me. |
| | | |
|--------|--------|------------------------------------------------------------|
| 18 | varies | Image Identification Field.