Magnum::Trade::TgaImageConverter class

TGA image converter plugin.

Creates Truevision TGA (*.tga) files from images with format PixelFormat::RGB8Unorm, PixelFormat::RGBA8Unorm or PixelFormat::R8Unorm.


This plugin depends on the Trade library and is built if MAGNUM_WITH_TGAIMAGECONVERTER is enabled when building Magnum. To use as a dynamic plugin, load "TgaImageConverter" via Corrade::PluginManager::Manager.

Additionally, if you're using Magnum as a CMake subproject, do the following:

add_subdirectory(magnum EXCLUDE_FROM_ALL)

# So the dynamically loaded plugin gets built implicitly
add_dependencies(your-app Magnum::TgaImageConverter)

To use as a static plugin or as a dependency of another plugin with CMake, you need to request the TgaImageConverter component of the Magnum package and link to the Magnum::TgaImageConverter target:

find_package(Magnum REQUIRED TgaImageConverter)

# ...
target_link_libraries(your-app PRIVATE Magnum::TgaImageConverter)

See Downloading and building, Usage with CMake, Loading and using plugins and File format support for more information.

Behavior and limitations

The output is always uncompressed. If you want to make use of RLE compression and have the files smaller, use the StbImageConverter plugin instead.

The TGA file format doesn't have a way to distinguish between 2D and 1D array images. If an image has ImageFlag2D::Array set, a warning is printed and the file is saved as a regular 2D image.

While TGA files can have several extensions, extension() always returns "tga" as that's the most common one. As TGA doesn't have a registered MIME type, mimeType() returns "image/x-tga".

Base classes

class AbstractImageConverter
Base for image converter plugins.

Constructors, destructors, conversion operators

TgaImageConverter() explicit
Default constructor.
TgaImageConverter(PluginManager::AbstractManager& manager, const Containers::StringView& plugin) explicit
Plugin manager constructor.