TGA

image/x-tga

Safe

Magic Bytes

Offset: 1
01 01 00 00

TGA, also known as the Truevision Graphics Adapter format, is a raster graphics file format created by Truevision Inc. in 1984. It is primarily used in the video game industry and computer animation for storing texture maps and sprites due to its support for alpha channels. While largely considered a legacy format superseded by PNG, it remains relevant in specialized 3D modeling workflows and is inherently safe as it lacks script support.

Extension

.tga

MIME Type

image/x-tga

Byte Offset

1

Risk Level

Safe

Validation Code

How to validate .tga files in Python

Python
def is_tga(file_path: str) -> bool:
    """
    Check if file is a valid TGA by magic bytes.
    Signature offset: 1 bytes
    """
    signature = bytes([0x01, 0x01, 0x00, 0x00])
    with open(file_path, "rb") as f:
        f.seek(1)
        return f.read(4) == signature

How to validate .tga files in Node.js

Node.js
function isTGA(buffer: Buffer): boolean {
  // Signature offset: 1 bytes
  const signature = Buffer.from([0x01, 0x01, 0x00, 0x00]);
  if (buffer.length < 5) return false;
  return buffer.subarray(1, 5).equals(signature);
}
Go
func IsTGA(data []byte) bool {
    // Signature offset: 1 bytes
    signature := []byte{0x01, 0x01, 0x00, 0x00}
    if len(data) < 5 {
        return false
    }
    return bytes.Equal(data[1:5], signature)
}

API Endpoint

GET /api/v1/tga
curl https://filesignature.org/api/v1/tga

Related Formats