Free webp to jpg
TGA

Truevision TGA (Legacy MIME Alias)

image/x-tga Released 1984 · by Truevision Inc.

The image/x-tga MIME type is a common unofficial alias for the Truevision TGA (TARGA) image format. Created in 1984 by Truevision Inc. for their early video capture boards, TGA was a pioneering raster format supporting 24-bit true color and a 32-bit alpha channel on PCs. Its straightforward byte structure, native transparency, and fast, lossless Run-Length Encoding (RLE) compression made it an industry standard for 3D animation, video editing, and video game textures throughout the 1990s and 2000s. Although standard MIME validators typically prefer 'image/tga' or 'image/x-targa', 'image/x-tga' is frequently encountered in legacy systems, game engine asset pipelines, and older web servers.

Raster Graphics & Textures Transparency Production Ready

Technical Specifications

MIME Type
image/x-tga
Extensions
.tga.icb.vda.vst
Container
Truevision TGA Footer/Header
Compression
Uncompressed & Run-Length Encoding (RLE)
Algorithms
NoneRLE
Color Depth
8-bit (Grayscale or Indexed), 16-bit (High Color), 24-bit (True Color), 32-bit (True Color with Alpha Channel)
Metadata
None
Capabilities
Transparency
Animation
Progressive Loading
Alpha Channel
HDR Support
Official Specification
Aliases: image/tgaimage/x-targaapplication/tga

Magic Bytes & HTTP Headers

File Signature (Magic Bytes)
54 52 55 45 56 49 53 49 4F 4E 2D 58 46 49 4C 45 2E 00 (At the end of the file)
ASCII: TRUEVISION-XFILE.\x00
HTTP Headers
Content-Type: image/x-tga
Content-Type: image/x-targa
HTML Accept Attribute
accept="image/x-tga, image/x-targa, .tga"

Browser Support Matrix

Browser Status Min Version
Chrome Chrome
Not Supported
Firefox Firefox
Not Supported
Safari Safari
Not Supported
Edge Edge
Not Supported
Internet Explorer Internet Explorer
Not Supported Legacy

Advantages & Limitations

Advantages
  • Incredibly simple byte layout allows developers to write custom loaders and exporters in a few dozen lines of code, bypassing the need for heavy external libraries
  • Native support for 8-bit alpha channels ensures flawless transparency masking for real-time 3D rendering
  • Fast, predictable RLE decoding requires almost no CPU overhead compared to DEFLATE (PNG) or DCT (JPEG)
Limitations
  • RLE compression is relatively weak by modern standards, resulting in large file sizes
  • Lacks a standard magic byte header at the beginning of the file, making file-sniffing unreliable for older v1.0 files
  • Zero support in web browsers; must be converted to PNG or WebP for web delivery

Developer Code Snippets

import os
# To reliably detect TGA 2.0, you must check the footer at the end of the file
with open('texture.tga', 'rb') as f:
    f.seek(-18, os.SEEK_END)
    signature = f.read(17)
    is_tga = signature == b'TRUEVISION-XFILE.'
    print('Is TGA 2.0:', is_tga)
const fs = require('fs');
// Seeking to the end of the file to check for the TGA 2.0 footer
const stats = fs.statSync('texture.tga');
if (stats.size >= 18) {
    const buffer = Buffer.alloc(17);
    const fd = fs.openSync('texture.tga', 'r');
    fs.readSync(fd, buffer, 0, 17, stats.size - 18);
    fs.closeSync(fd);
    const isTGA = buffer.toString('ascii') === 'TRUEVISION-XFILE.';
    console.log('Is Truevision TGA v2:', isTGA);
}
import (
    "os"
)
// Native Go HTTP detection will not recognize TGA.
// You must read the end of the file:
// file, _ := os.Open("texture.tga")
// stat, _ := file.Stat()
// buf := make([]byte, 17)
// file.ReadAt(buf, stat.Size()-18)
// isTGA := string(buf) == "TRUEVISION-XFILE."
$mime = mime_content_type('texture.tga');
echo $mime; // May return 'image/x-tga', 'image/x-targa', or 'application/octet-stream' depending on OS magic definitions and whether it is a v1.0 or v2.0 file.

File Detection Steps

How to programmatically detect a image/x-tga file by reading its raw bytes:

  1. 1 Because TGA 1.0 files do not have a magic number at the beginning of the file, MIME detection strictly by reading offset 0 is impossible.
  2. 2 The TGA 2.0 specification introduced a file footer. To detect a TGA 2.0 file, seek to the end of the file. The last 26 bytes make up the footer. Bytes 8 through 23 of this footer (18 bytes from EOF) contain the ASCII signature 'TRUEVISION-XFILE.' followed by a null terminator.
  3. 3 When encountering 'image/x-tga' in file uploads, it is recommended to normalize the MIME type string in your database to 'image/tga' or 'image/x-targa' to align with broader conventions.

Software Support

A
Adobe Photoshop
B
Blender / Maya / 3ds Max
U
Unreal Engine / Unity
ImageMagick ImageMagick

Conversion Tools

Share & Embed

Markdown Badge
TGA Format Badge
[![TGA Format](https://freewebptojpg.com/mime/image/tga/badge.svg)](https://freewebptojpg.com/mime/image/tga)
Interactive iframe Widget
<iframe src="https://freewebptojpg.com/mime/image/tga/embed" width="100%" height="280" style="border:1px solid #cbd5e1;border-radius:8px;" title="TGA Specs"></iframe>

JSON API

All data on this page is available as a free, open JSON API. Use it in your project, documentation, or tooling.

GET https://freewebptojpg.com/mime/image/tga.json Open JSON
Free to use
No auth required
CORS enabled
Use from any domain
Cached 24h
Cache-Control headers set

Frequently Asked Questions

What is the difference between image/x-tga and image/x-targa?

There is no difference in the underlying file. Both MIME types refer to the Truevision TGA (TARGA) image format. 'image/x-targa' and 'image/tga' are more commonly recognized by modern systems, while 'image/x-tga' is an older alias often generated by legacy software.

Why do video games still use TGA files?

TGA files are structurally very simple, making them incredibly fast for a game engine to decode and load into memory (VRAM). Their native support for an 8-bit alpha channel also ensures perfect transparency masking for 3D textures, decals, and foliage.

How do I detect a TGA file programmatically?

Original TGA 1.0 files lacked a header signature. However, the TGA 2.0 specification introduced a file footer. You can reliably detect a TGA 2.0 file by reading the last 18 bytes of the file, which will contain the ASCII string 'TRUEVISION-XFILE.'.

Related Formats

Share this format