TGA (.tga)

Background & Context

    • Common MIME types: application/tga, image/tga, image/tga
    • Truevision TARGA format.
    • Raster image file format.
    • Widely used in animation and video applications.
    • Was native format of TARGA video cards.
    • Binary format.
    • Supports color-mapped and true-color raster images.
    • Can compress data using a run-length encoding method.
    • Supports alpha channels.
    • Introduced by Truevision in 1984, updated as Version 2.0 in 1989.

Import & Export

  • Import["file.tga"] imports a TGA file and returns an image.
  • Import["file.tga",elem] imports the specified element from TGA.
  • The import format can be specified with Import["file","TGA"] or Import["file",{"TGA",elem,}].
  • Export["file.tga",expr] exports an image, graphics, or any other expression as a raster image to TGA.
  • When exporting Wolfram Language graphics or arbitrary expressions to TGA, the resulting image has the same raster size as its displayed form.
  • Image objects are by default exported at their raster size.
  • Because TGA is a raster image format, all fonts are rasterized on export.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Data"array of color values
    "Graphics"Graphics object representing an image
    "Image"raster image represented as an Image object
  • Import and Export by default use the "Image" element for TGA files.
  • Advanced Import elements:
  • "BitDepth"bits used to represent each color channel in the file
    "Channels"the number of color channels used in the file
    "ColorSpace"color encoding used in the file
    "ImageSize"raster dimensions
    "Summary"summary of the file



Basic Examples  (3)

Import a TGA file:

Summary of an image:

Export a raster image to TGA: