tgatoppm
Convert TGA image to PPM image
TLDR
Convert a TrueVision Targa file to a PPM image
Dump information from the TGA header to stdout
Write the transparency channel values of the input image to the specified file
Display version
SYNOPSIS
tgatoppm [tgadevice]
PARAMETERS
tgadevice
Optional. Specifies the path to the input Truevision Targa (TGA) file. If omitted, tgatoppm reads the TGA data from standard input.
DESCRIPTION
tgatoppm is a utility from the Netpbm image processing suite. Its primary function is to convert image files in the Truevision Targa (TGA) format into the Portable Pixmap (PPM) format. TGA files are common for storing images, particularly in video games and professional image editing. PPM is a simple, uncompressed image format, part of the Netpbm family, designed for easy manipulation and conversion between various image types.
tgatoppm reads the TGA image from a specified file or standard input if no file is given, and writes the resulting PPM image to standard output. It supports different TGA types, including truecolor, colormapped, and black-and-white, converting them all to truecolor PPM. It also handles both uncompressed and Run-Length Encoded (RLE) TGA data. This conversion is often a crucial step in workflows that require processing TGA files with other Netpbm tools or converting them to more widely supported formats.
CAVEATS
Alpha Channel Discarded: tgatoppm ignores any alpha channel information present in 32-bit TGA files. The output PPM format does not support alpha transparency, so this data is lost during conversion.
Color Mapping to Truecolor: Even if the input TGA file uses a color map (indexed color), the output will always be a truecolor PPM. This may result in larger file sizes for images that could otherwise be represented more compactly.
Standard Output Only: The command outputs the PPM data exclusively to standard output, requiring redirection (e.g., > output.ppm
) to save the result to a file.
PIPELINE USAGE
tgatoppm is designed to work seamlessly in command-line pipelines. For example, to convert a TGA file and then apply a gamma correction:tgatoppm input.tga | pnmgamma 2.2 > output.ppm
INPUT/OUTPUT STREAMS
By default, if no tgadevice argument is provided, the command reads TGA data from standard input. This allows it to process TGA data piped from another command. The output PPM data is always written to standard output.
HISTORY
tgatoppm is an integral part of the Netpbm project, a widely used open-source graphics library and toolkit. The Netpbm suite originated from the pbmplus package created by Jef Poskanzer in the late 1980s. Its design emphasizes simple, atomic tools that can be chained together via pipelines, a philosophy that tgatoppm perfectly embodies. It has been maintained and expanded upon by various developers over decades, ensuring its continued relevance for image format conversion on Unix-like systems.