Magnum::Trade::AnyImageImporter class

Any image importer plugin.

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

This plugin depends on the Trade library and is built if WITH_ANYIMAGEIMPORTER is enabled when building Magnum. To use as a dynamic plugin, you need to load the "AnyImageImporter" 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 AnyImageImporter component of the Magnum package and link to the Magnum::AnyImageImporter target. See Downloading and building, Usage with CMake and Loading and using plugins for more information.

Supported formats:

  • Windows Bitmap (*.bmp), loaded with any plugin that provides BmpImporter
  • DirectDraw Surface (*.dds), loaded with DdsImporter or any other plugin that provides it
  • Graphics Interchange Format (*.gif), loaded with any plugin that provides GifImporter
  • OpenEXR (*.exr), loaded with any plugin that provides OpenExrImporter
  • Radiance HDR (*.hdr), loaded with any plugin that provides HdrImporter
  • JPEG (*.jpg, *.jpe, *.jpeg), loaded with JpegImporter or any other plugin that provides it
  • JPEG 2000 (*.jp2), loaded with any plugin that provides Jpeg2000Importer
  • Multiple-image Network Graphics (*.mng), loaded with any plugin that provides MngImporter
  • Portable Bitmap (*.pbm), loaded with any plugin that provides PbmImporter
  • ZSoft PCX (*.pcx), loaded with any plugin that provides PcxImporter
  • Portable Graymap (*.pgm), loaded with any plugin that provides PgmImporter
  • Softimage PIC (*.pic), loaded with any plugin that provides PicImporter
  • Portable Anymap (*.pnm), loaded with any plugin that provides PnmImporter
  • Portable Network Graphics (*.png), loaded with PngImporter or any other plugin that provides it
  • Portable Pixmap (*.ppm), loaded with any plugin that provides PpmImporter
  • Adobe Photoshop (*.psd), loaded with any plugin that provides PsdImporter
  • Silicon Graphics (*.sgi, *.bw, *.rgb, *.rgba), loaded with any plugin that provides SgiImporter
  • Tagged Image File Format (*.tif, *.tiff), loaded with any plugin that provides TiffImporter
  • Truevision TGA (*.tga, *.vda, *.icb, *.vst), loaded with TgaImporter or any other plugin that provides it

Only loading from files is supported.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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

Private functions

auto doFeatures() const override -> Features virtual
Implementation for features()
auto doIsOpened() const override -> bool virtual
Implementation for isOpened()
void doClose() override virtual
Implementation for close()
void doOpenFile(const std::string& filename) override virtual
Implementation for openFile()
auto doImage2DCount() const override -> UnsignedInt virtual
Implementation for image2DCount()
auto doImage2D(UnsignedInt id) override -> Containers::Optional<ImageData2D> virtual
Implementation for image2D()

Function documentation

void Magnum::Trade::AnyImageImporter::doOpenFile(const std::string& filename) override virtual private

Implementation for openFile()

If Feature::OpenData is supported, default implementation opens the file and calls doOpenData() with its contents. It is allowed to call this function from your doOpenFile() implementation.

UnsignedInt Magnum::Trade::AnyImageImporter::doImage2DCount() const override virtual private

Implementation for image2DCount()

Default implementation returns 0.