Truevision TGA

Last updated
Truevision TGA
Filename extensions
.tga, .icb, .vda, .vst
Internet media type
image/x-targa [1]
image/x-tga
Type code 'TPIC'
Uniform Type Identifier (UTI) com.truevision.tga-image
Developed by Truevision
Type of format Raster image file

Truevision TGA, often referred to as TARGA, is a raster graphics file format created by Truevision Inc. (now part of Avid Technology). It was the native format of TARGA and VISTA boards, which were the first graphic cards for IBM-compatible PCs to support Highcolor/truecolor display. This family of graphic cards was intended for professional computer image synthesis and video editing with PCs; for this reason, usual resolutions of TGA image files match those of the NTSC and PAL video formats. [2]

Contents

TARGA is an acronym for Truevision Advanced Raster Graphics Adapter; TGA is an initialism for Truevision Graphics Adapter.

TGA files commonly have the extension ".tga" on PC DOS/Windows systems and macOS (older Macintosh systems use the "TPIC" type code). The format can store image data with 8, 15, 16, 24, or 32 bits of precision per pixel [3] the maximum 24 bits of RGB and an extra 8-bit alpha channel. Color data can be color-mapped, or in direct color or truecolor format. Image data may be stored raw, or optionally, a lossless RLE compression similar to PackBits can be employed. This type of compression performs poorly for typical photographic images, but works acceptably well for simpler images, such as icons, cartoons and line drawings.

History

The TGA file format was originally defined and specified by AT&T EPICenter with feedback from Island Graphics Inc in 1984. AT&T EPICenter was an internal spin-off of AT&T created to market new technologies AT&T had developed for color frame buffers. What later became Truevision was the result of a leveraged employee buyout from AT&T in 1987.

EPICenter's first two cards, the VDA (video display adapter) and ICB (image capture board), used the first incarnations of the TGA file format. The file extensions ".vda" and ".icb" implied information about the board specific data contained.

It was later determined by Alan Wlasuk (then head of EPICenter), Brad Pillow (EPICenter) and Steven Dompier (Island's president) that a more codified file format was needed. The file format was created and implemented by Brad Pillow (EPICenter) and Bryan Hunt (EPICenter) and was developed in response to this need for a less board specific file format. A very simple extension was made to what was already in use, and contained information on width, height, pixel depth, an associated color map and image origin. A label field (up to 255 characters) was also included in the initial spec, but was rarely used.

At the time, another technically superior file format called TIFF also appeared, but its use for true color images was very limited as the implementation and sharing of files between applications supporting the TIFF specification was rather difficult and involved. The TGA file format's simpler nature and portability between platforms is the main reason for its widespread adoption and its continued success in a wide variety of applications worldwide to this day.

Initially the TGA file format was used in the ICB-PAINT and TARGA-PAINT programs (what later became known as TIPS) and for several projects in online real estate browsing and still-frame video teleconferencing.

The current version (2.0) includes several enhancements such as "postage stamps" (better known as thumbnails), an alpha channel, gamma value, and textual metadata, and was authored by Truevision Inc.'s Shawn Steiner with direction from Kevin Friedly and David Spoelstra in 1989.

At the time of its launching, it represented the state of the art in digital image processing. Even today, though its maximum color depth is not well suited for high-end pre-press, intensive image processing systems, TGA is still used extensively throughout the animation and video industry because its primary intended outputs are standard TV screens, not color printed pages. [4]

Uncompressed 24-bit TGA images are relatively simple compared to several other prominent 24-bit storage formats: A 24-bit TGA contains only an 18-byte header followed by the image data as packed RGB data. In contrast, BMP requires padding rows to 4-byte boundaries, while TIFF and PNG are metadata containers that do not place the image data or attributes at a fixed location within the file.

32-bit TGA images contain an alpha channel, or key signal, and are often used in character generator programs such as Avid Deko.

Technical details

All values are little-endian; field and subfield numbers are per Version 2.0 of the specification.

Version 2 added the extension area and footer. The developer area exists to store application-specific information.

Field no.LengthField nameDescription
11 byteID lengthLength of the image ID field
21 byteColor map typeWhether a color map is included
31 byteImage typeCompression and color types
45 bytesColor map specificationDescribes the color map
510 bytesImage specificationImage dimensions and format

Image ID length (field 1)

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.

As of version 2.0 of the TGA spec, the date and time the image was created is catered for in the extension area.

Color map type (field 2)

has the value:

Image type (field 3)

is enumerated in the lower three bits, with the fourth bit as a flag for RLE. Some possible values are:

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 (field 4)

has three subfields:

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.

Image specification (field 5)

has six subfields:

Bit 4 of the image descriptor byte indicates right-to-left pixel ordering if set. Bit 5 indicates an ordering of top-to-bottom. Otherwise, pixels are stored in bottom-to-top, left-to-right order.

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)

Version 1.0 of the TGA specification was very basic, and many developers had a need to store more information, and so opted to add on extra sections to their files, specific to their application only.

In Version 2.0 of the specification, these application-specific enhancements/extras are supported by the developer area. Only the offset and size of the developer area are relevant to the spec, and developers are free to add whatever they want in the area.

If a TGA decoder cannot interpret the information in the developer area, it will generally ignore it, since it is assumed to have been created by a different application. It is recommended that developers build logic into their applications to determine whether the data in the developer area is compatible with the application; one step towards this is to check the software ID in the file footer.

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 stamp offsetNumber 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

If a TGA file contains a footer, it is likely to be a TGA version 2 file. The footer is the final 26 bytes of the file, of which the last 18 are constant.

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 NUL

Specification discrepancies

The older version of the TGA file format specification taken from the Appendix C of the Truevision Technical Guide states that run-length encoded (RLE) packets may cross scan lines: "For the run length packet, the header is followed by a single color value, which is assumed to be repeated the number of times specified in the header. The packet may cross scan lines (begin on one line and end on the next)".

However, page 24 of the TGA v2.0 specification states the exact opposite: "Run-length Packets should never encode pixels from more than one scan line. Even if the end of one scan line and the beginning of the next contain pixels of the same value, the two should be encoded as separate packets. In other words, Run-length Packets should not wrap from one line to another".

Consequently TGA readers need to be able to handle RLE data packets that cross scan lines since this was part of the original specification. However, when saving (creating) TGA files it will be necessary to limit RLE data packets to scanline boundaries in order to be compliant with the newer v2.0 TGA specification.

Related Research Articles

GIF Bitmap image file format family

The Graphics Interchange Format is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on 15 June 1987. It has since come into widespread usage on the World Wide Web due to its wide support and portability between applications and operating systems.

Lossless compression is a class of data compression that allows the original data to be perfectly reconstructed from the compressed data with no loss of information. Lossless compression is possible because most real-world data exhibits statistical redundancy. By contrast, lossy compression permits reconstruction only of an approximation of the original data, though usually with greatly improved compression rates.

Portable Network Graphics Family of lossless compression file formats for image files

Portable Network Graphics is a raster-graphics file format that supports lossless data compression. PNG was developed as an improved, non-patented replacement for Graphics Interchange Format (GIF) — unofficially, the initials PNG stood for the recursive acronym "PNG's not GIF".

PCX, standing for PiCture eXchange, is an image file format developed by the now-defunct ZSoft Corporation of Marietta, Georgia, United States. It was the native file format for PC Paintbrush and became one of the first widely accepted DOS imaging standards, although it has since been succeeded by more sophisticated image formats, such as BMP, JPEG, and PNG. PCX files commonly stored palette-indexed images ranging from 2 or 4 colors to 16 and 256 colors, although the format has been extended to record true-color (24-bit) images as well.

PackBits is a fast, simple lossless compression scheme for run-length encoding of data.

Raster graphics Matrix-based data structure

In computer graphics and digital photography, a raster graphic represents a two-dimensional image as a rectangular matrix or grid of square pixels, viewable via a computer display, paper, or other display medium. A raster is technically characterized by the width and height of the image in pixels and by the number of bits per pixel. Raster images are stored in image files with varying dissemination, production, generation, and acquisition formats.

Run-length encoding (RLE) is a form of lossless data compression in which runs of data are stored as a single data value and count, rather than as the original run. This is most efficient on data that contains many such runs, for example, simple graphic images such as icons, line drawings, Conway's Game of Life, and animations. For files that do not have many runs, RLE could increase the file size.

bzip2 File compression software

bzip2 is a free and open-source file compression program that uses the Burrows–Wheeler algorithm. It only compresses single files and is not a file archiver. It was developed by Julian Seward, and maintained by Mark Wielaard and Micah Snyder.

The JPEG File Interchange Format (JFIF) is an image file format standard published as ITU-T Recommendation T.871 and ISO/IEC 10918-5. It defines supplementary specifications for the container format that contains the image data encoded with the JPEG algorithm. The base specifications for a JPEG container format are defined in Annex B of the JPEG standard, known as JPEG Interchange Format (JIF). JFIF builds over JIF to solve some of JIF's limitations, including unnecessary complexity, component sample registration, resolution, aspect ratio, and color space. Because JFIF is not the original JPG standard, one may expect another mime-type, but somehow it's still registered as "image/jpeg".

TIFF Series of image file formats

Tag Image File Format, abbreviated TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processing, optical character recognition, image manipulation, desktop publishing, and page-layout applications. The format was created by the Aldus Corporation for use in desktop publishing. It published the latest version 6.0 in 1992, subsequently updated with an Adobe Systems copyright after the latter acquired Aldus in 1994. Several Aldus or Adobe technical notes have been published with minor extensions to the format, and several specifications have been based on TIFF 6.0, including TIFF/EP, TIFF/IT, TIFF-F and TIFF-FX.

OpenEXR is a high-dynamic range, multi-channel raster file format, released as an open standard along with a set of software tools created by Industrial Light & Magic (ILM), under a free software license similar to the BSD license.

The BMP file format, also known as bitmap image file, device independent bitmap (DIB) file format and bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device, especially on Microsoft Windows and OS/2 operating systems.

ILBM File format

Interleaved Bitmap (ILBM) is an image file format conforming to the Interchange File Format (IFF) standard. The format originated on the Amiga platform, and on IBM-compatible systems, files in this format or the related PBM format are typically encountered in games from late 1980s and early 1990s that were either Amiga ports or had their graphical assets designed on Amiga machines.

The Lempel–Ziv–Markov chain algorithm (LZMA) is an algorithm used to perform lossless data compression. It has been under development since either 1996 or 1998 by Igor Pavlov and was first used in the 7z format of the 7-Zip archiver. This algorithm uses a dictionary compression scheme somewhat similar to the LZ77 algorithm published by Abraham Lempel and Jacob Ziv in 1977 and features a high compression ratio and a variable compression-dictionary size, while still maintaining decompression speed similar to other commonly used compression algorithms.

Netpbm is an open-source package of graphics programs and a programming library. It is used mainly in the Unix world, where one can find it included in all major open-source operating system distributions, but also works on Microsoft Windows, macOS, and other operating systems.

Image file formats are standardized means of organizing and storing digital images. An image file format may store data in an uncompressed format, a compressed format, or a vector format. Image files are composed of digital data in one of these formats so that the data can be rasterized for use on a computer display or printer. Rasterization converts the image data into a grid of pixels. Each pixel has a number of bits to designate its color. Rasterizing an image file for a specific device takes into account the number of bits per pixel that the device is designed to handle.

In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization compression.

Silicon Graphics Image (SGI) or the RGB file format is the native raster graphics file format for Silicon Graphics workstations. The format was invented by Paul Haeberli. It can be run-length encoded (RLE). FFmpeg and ImageMagick, among others, support this format.

In computing, a bitmap is a mapping from some domain to bits. It is also called a bit array or bitmap index.

QOI (image format) Image compression file format

The Quite OK Image Format (QOI) is a specification for image compression of 24-bit or 32-bit color raster (bitmapped) images, invented by Dominic Szablewski and first announced November 24th 2021.

References

  1. .tga MIME type not registered at IANA
  2. James D. Murray, William vanRyper (April 1996). Encyclopedia of Graphics File Formats, Second Edition . O'Reilly. ISBN   1-56592-161-5 . Retrieved 2014-03-07.{{cite book}}: CS1 maint: uses authors parameter (link)
  3. "Truevision TGAª — FILE FORMAT SPECIFICATION — Version 2.0" (PDF).
  4. "Truevision TGA, version 2.0". Digital Preservation. Library of Congress. 2005-02-24. Retrieved 2021-06-08.