Magnum::Trade::AnyImageConverter class

Any image converter plugin.

Detects file type based on file extension, loads corresponding plugin and then tries to convert the file with it.

This plugin depends on the Trade library and is built if WITH_ANYIMAGECONVERTER is enabled when building Magnum. To use as a dynamic plugin, you need to load the "AnyImageConverter" plugin from MAGNUM_PLUGINS_IMPORTER_DIR. To use as a static plugin or as a dependency of another plugin with CMake, you need to request the AnyImageConverter component of the Magnum package and link to the Magnum::AnyImageConverter target. See Downloading and building, Usage with CMake and Loading and using plugins for more information.

Supported formats for uncompressed data:

  • OpenEXR (*.exr), converted with any plugin that provides OpenExrImageConverter
  • Windows Bitmap (*.bmp), converted with any plugin that provides BmpImageConverter
  • Radiance HDR (*.hdr), converted with any plugin that provides HdrImageConverter
  • Portable Network Graphics (*.png), converted with PngImageConverter or any other plugin that provides it
  • Truevision TGA (*.tga, *.vda, *.icb, *.vst), converted with TgaImageConverter or any other plugin that provides it

No supported formats for compressed data yet.

Only exporting to files is supported.

Base classes

class AbstractImageConverter
Base for image converter plugins.

Constructors, destructors, conversion operators

AnyImageConverter(PluginManager::Manager<AbstractImageConverter>& manager) explicit
Constructor with access to plugin manager.
AnyImageConverter(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.

Private functions

auto doFeatures() const override -> Features virtual
Implementation of features()
auto doExportToFile(const ImageView2D& image, const std::string& filename) override -> bool virtual
Implementation of exportToFile(const ImageView2D&, const std::string&)
auto doExportToFile(const CompressedImageView2D& image, const std::string& filename) override -> bool virtual
Implementation of exportToFile(const CompressedImageView2D&, const std::string&)

Function documentation

bool Magnum::Trade::AnyImageConverter::doExportToFile(const ImageView2D& image, const std::string& filename) override virtual private

Implementation of exportToFile(const ImageView2D&, const std::string&)

If Feature::ConvertData is supported, default implementation calls doExportToData(const ImageView2D&) and saves the result to given file.

bool Magnum::Trade::AnyImageConverter::doExportToFile(const CompressedImageView2D& image, const std::string& filename) override virtual private

Implementation of exportToFile(const CompressedImageView2D&, const std::string&)

If Feature::ConvertCompressedData is supported, default implementation calls doExportToData(const CompressedImageView2D&) and saves the result to given file.