Magnum::Trade::AbstractImageConverter class

Base for image converter plugins.

Provides functionality for converting images between various formats, compressing them or saving to files.

The interface supports three main kinds of operation, with implementations commonly advertising support for a subset of them via features():

Usage

Image converters are commonly implemented as plugins, which means the concrete converter implementation is loaded and instantiated through a PluginManager::Manager. Then, based on the intent and on what the particular converter supports, convertToFile(), convertToData() or convert() gets called.

As each converter has different requirements and supports different pixel formats, you're expected to perform error handling on the application side — if a conversion fails, you get an empty Containers::Optional or false and a reason printed to Error. Everything else (using a feature not implemented in the converter, ...) is treated as a programmer error and will produce the usual assertions.

Saving an image to a file

In the following example an 8-bit RGBA image is saved as a PNG using the AnyImageConverter plugin, together with all needed error handling. In this case we know that AnyImageConverter supports ImageConverterFeature::Convert2DToFile, however in a more general case and especially when dealing with compressed image formats it might be good to check against the reported features() first.

PluginManager::Manager<Trade::AbstractImageConverter> manager;
Containers::Pointer<Trade::AbstractImageConverter> converter =
    manager.loadAndInstantiate("AnyImageConverter");

Image2D image{PixelFormat::RGBA8Unorm, size, };
if(!converter || !converter->convertToFile(image, "image.png"))
    Fatal{} << "Can't save image.png with AnyImageConverter";

See Loading and using plugins for more information about general plugin usage, File format support to compare implementations of common file formats and the list of derived classes for all available image converter plugins.

Saving a set of mip levels

Certain file formats, such as OpenEXR, DDS or ICO, are capable of storing multiple image mip levels in a single file. Each format has a slightly different set of rules for image sizes and their order, in general putting the largest level first and then gradually halving the size should always work. In the following snippet we'll save three mip levels to an EXR file, again using the AnyImageConverter plugin, which will then most likely delegate to OpenExrImageConverter:

PluginManager::Manager<Trade::AbstractImageConverter> manager;
Containers::Pointer<Trade::AbstractImageConverter> converter =
    manager.loadAndInstantiate("AnyImageConverter");

Image2D level0{PixelFormat::RGBA16F, {256, 256}, };
Image2D level1{PixelFormat::RGBA16F, {128, 128}, };
Image2D level2{PixelFormat::RGBA16F, {64, 64}, };

if(!converter || !converter->convertToFile({level0, level1, level2}, "image.exr"))
    Fatal{} << "Can't save image.exr with AnyImageConverter";

Converting image data

In the following snippet we use StbDxtImageConverter to convert the same 8-bit RGBA image as above to a block-compressed one with CompressedPixelFormat::Bc3RGBAUnorm. While AnyImageConverter can detect the desired format when writing to a file and act accordingly, here it would have no way to know what we want and so we request the concrete plugin name directly. Here we again know that StbDxtImageConverter gives us back a compressed image and so we can put in just a sanity assert, but in the general case it's converter-dependent and may even rely on configuration options set for the plugin.

PluginManager::Manager<Trade::AbstractImageConverter> manager;
Containers::Pointer<Trade::AbstractImageConverter> converter =
    manager.loadAndInstantiate("StbDxtImageConverter");

Containers::Optional<Trade::ImageData2D> compressed;
if(!converter || !(compressed = converter->convert(image)))
    Fatal{} << "Can't convert the image with StbDxtImageConverter";
CORRADE_INTERNAL_ASSERT(compressed->isCompressed());

Commonly, when operating directly on the image data, each plugin exposes a set of configuration options to specify what actually gets done and how, and the default setup may not even do anything. See Editing plugin-specific configuration for details and a usage example.

Data dependency

The ImageData instances returned from various functions by design have no dependency on the converter instance and neither on the dynamic plugin module. In other words, you don't need to keep the converter instance (or the plugin manager instance) around in order to have the ImageData instances valid. Moreover, all returned Containers::Array instances returned either directly or through ImageData are only allowed to have default deleters — this is to avoid potential dangling function pointer calls when destructing such instances after the plugin module has been unloaded.

Some converter implementations may point ImageData::importerState() to some internal state in the converter instance, but in that case the relation is weak — these will be valid only as long as the particular converter documents, usually either until the next conversion is performed or until the converter is destroyed. After that, the state pointers become dangling, and that's fine as long as you don't access them.

Subclassing

The plugin needs to implement the doFeatures() function and one or more of doConvert(), doConvertToData() or doConvertToFile() functions based on what features are supported.

You don't need to do most of the redundant sanity checks, these things are checked by the implementation:

  • The doExtension() and doMimeType() functions are called only if ImageConverterFeature::Convert*ToData or Convert*ToFile is supported
  • The doConvert(), doConvertToData() and doConvertToFile() functions are called only if a corresponding ImageConverterFeature is supported
  • All doConvertToData() and doConvertToFile() functions taking a single (compressed) image are called only if the image has a non-zero size in all dimensions and the view is not nullptr. Note that this does not apply to doConvert() — there a zero-size image or a nullptr view may be a valid use case, and if the plugin implementation doesn't work with any of those, it's expected to check that on its own and produce a runtime error.
  • All doConvertToData() and doConvertToFile() functions taking multiple (compressed) images are called only if the list has at least one image, each of the images has a non-zero size, the views are not nullptr and additionally all views have the same pixel format and layout flags. Since file formats have varying requirements on image level sizes and their order and some don't impose any requirements at all, the plugin implementation is expected to check the sizes on its own.

Derived classes

class AnyImageConverter
Any image converter plugin.
class BasisImageConverter new in 2019.10
Basis Universal image converter plugin.
class BcDecImageConverter new in Git master
BCn-compressed image decoding using bcdec.
class EtcDecImageConverter new in Git master
ETC/EAC-compressed image decoding using etcdec.
class JpegImageConverter
JPEG image converter plugin.
class KtxImageConverter new in Git master
KTX2 image converter plugin.
class MiniExrImageConverter
OpenEXR image converter plugin using miniexr.
class OpenExrImageConverter new in Git master
OpenEXR image converter plugin.
class PngImageConverter
PNG image converter plugin.
class StbDxtImageConverter new in Git master
BC1/BC3 compressor using stb_dxt.
class StbImageConverter
Image converter plugin using stb_image_write.
class StbResizeImageConverter new in Git master
Image resizing using stb_image_resize.
class TgaImageConverter
TGA image converter plugin.
class WebPImageConverter new in Git master
WebP image converter plugin.

Public types

using Feature = ImageConverterFeature deprecated in 2020.06
Features supported by an image converter.
using Features = ImageConverterFeatures deprecated in 2020.06
Features supported by an image converter.

Public static functions

static auto pluginInterface() -> Containers::StringView
Plugin interface.
static auto pluginSearchPaths() -> Containers::Array<Containers::String>
Plugin search paths.

Constructors, destructors, conversion operators

AbstractImageConverter() explicit
Default constructor.
AbstractImageConverter(PluginManager::Manager<AbstractImageConverter>& manager) explicit
Constructor with access to plugin manager.
AbstractImageConverter(PluginManager::AbstractManager& manager, const Containers::StringView& plugin) explicit
Plugin manager constructor.

Public functions

auto features() const -> ImageConverterFeatures
Features supported by this converter.
auto flags() const -> ImageConverterFlags new in 2020.06
Converter flags.
void setFlags(ImageConverterFlags flags) new in 2020.06
Set converter flags.
void addFlags(ImageConverterFlags flags) new in Git master
Add converter flags.
void clearFlags(ImageConverterFlags flags) new in Git master
Clear converter flags.
auto extension() const -> Containers::String new in Git master
File extension.
auto mimeType() const -> Containers::String new in Git master
File MIME type.
auto convert(const ImageView1D& image) -> Containers::Optional<ImageData1D> new in Git master
Convert a 1D image.
auto convert(const ImageView2D& image) -> Containers::Optional<ImageData2D> new in Git master
Convert a 2D image.
auto exportToImage(const ImageView2D& image) -> Containers::Optional<Image2D> deprecated in Git master
Convert a 2D image.
auto exportToCompressedImage(const ImageView2D& image) -> Containers::Optional<CompressedImage2D> deprecated in Git master
Convert a 2D image to compressed format.
auto convert(const ImageView3D& image) -> Containers::Optional<ImageData3D> new in Git master
Convert a 3D image.
auto convert(const CompressedImageView1D& image) -> Containers::Optional<ImageData1D> new in Git master
Convert a compressed 1D image.
auto convert(const CompressedImageView2D& image) -> Containers::Optional<ImageData2D> new in Git master
Convert a compressed 2D image.
auto convert(const CompressedImageView3D& image) -> Containers::Optional<ImageData3D> new in Git master
Convert a compressed 3D image.
auto convert(const ImageData1D& image) -> Containers::Optional<ImageData1D> new in Git master
Convert a 1D image data.
auto convert(const ImageData2D& image) -> Containers::Optional<ImageData2D> new in Git master
Convert a 2D image data.
auto convert(const ImageData3D& image) -> Containers::Optional<ImageData3D> new in Git master
Convert a 3D image data.
auto convertToData(const ImageView1D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a 1D image to a raw data.
auto convertToData(const ImageView2D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a 2D image to a raw data.
auto exportToData(const ImageView2D& image) -> Containers::Array<char> deprecated in Git master
Convert a 2D image to a raw data.
auto convertToData(const ImageView3D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a 3D image to a raw data.
auto convertToData(const CompressedImageView1D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a compressed 1D image to a raw data.
auto convertToData(const CompressedImageView2D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a compressed 2D image to a raw data.
auto exportToData(const CompressedImageView2D& image) -> Containers::Array<char> deprecated in Git master
Convert a compressed 2D image to a raw data.
auto convertToData(const CompressedImageView3D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a compressed 3D image to a raw data.
auto convertToData(const ImageData1D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a 1D image data to a raw data.
auto convertToData(const ImageData2D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a 2D image data to a raw data.
auto exportToData(const ImageData2D& image) -> Containers::Array<char> deprecated in Git master
Convert a 2D image data to a raw data.
auto convertToData(const ImageData3D& image) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a 3D image data to a raw data.
auto convertToData(Containers::ArrayView<const ImageView1D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a set of 1D image levels to a raw data.
auto convertToData(std::initializer_list<ImageView1D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
auto convertToData(Containers::ArrayView<const ImageView2D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a set of 2D image levels to a raw data.
auto convertToData(std::initializer_list<ImageView2D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
auto convertToData(Containers::ArrayView<const ImageView3D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a set of 3D image levels to a raw data.
auto convertToData(std::initializer_list<ImageView3D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
auto convertToData(Containers::ArrayView<const CompressedImageView1D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a set of compressed 1D image levels to a raw data.
auto convertToData(std::initializer_list<CompressedImageView1D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
auto convertToData(Containers::ArrayView<const CompressedImageView2D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a set of compressed 2D image levels to a raw data.
auto convertToData(std::initializer_list<CompressedImageView2D> imageLevels) -> Containers::Optional<Containers::Array<char>> new in Git master
auto convertToData(Containers::ArrayView<const CompressedImageView3D> images) -> Containers::Optional<Containers::Array<char>> new in Git master
Convert a set of compressed 3D image levels to a raw data.
auto convertToData(std::initializer_list<CompressedImageView3D> images) -> Containers::Optional<Containers::Array<char>> new in Git master
auto convertToFile(const ImageView1D& image, Containers::StringView filename) -> bool new in Git master
Convert a 1D image to a file.
auto convertToFile(const ImageView2D& image, Containers::StringView filename) -> bool new in Git master
Convert a 2D image to a file.
auto exportToFile(const ImageView2D& image, const std::string& filename) -> bool deprecated in Git master
Convert a 2D image to a file.
auto convertToFile(const ImageView3D& image, Containers::StringView filename) -> bool new in Git master
Convert a 3D image to a file.
auto convertToFile(const CompressedImageView1D& image, Containers::StringView filename) -> bool new in Git master
Convert a compressed 1D image to a file.
auto convertToFile(const CompressedImageView2D& image, Containers::StringView filename) -> bool new in Git master
Convert a compressed 2D image to a file.
auto exportToFile(const CompressedImageView2D& image, const std::string& filename) -> bool deprecated in Git master
Convert a compressed 2D image to a file.
auto convertToFile(const CompressedImageView3D& image, Containers::StringView filename) -> bool new in Git master
Convert a compressed 3D image to a file.
auto convertToFile(const ImageData1D& image, Containers::StringView filename) -> bool new in Git master
Convert a 1D image data to a file.
auto convertToFile(const ImageData2D& image, Containers::StringView filename) -> bool new in Git master
Convert a 2D image data to a file.
auto exportToFile(const ImageData2D& image, const std::string& filename) -> bool deprecated in Git master
Convert a 2D image data to a file.
auto convertToFile(const ImageData3D& image, Containers::StringView filename) -> bool new in Git master
Convert a 3D image data to a file.
auto convertToFile(Containers::ArrayView<const ImageView1D> imageLevels, Containers::StringView filename) -> bool new in Git master
Convert a set of 1D image levels to a file.
auto convertToFile(std::initializer_list<ImageView1D> imageLevels, Containers::StringView filename) -> bool new in Git master
auto convertToFile(Containers::ArrayView<const ImageView2D> imageLevels, Containers::StringView filename) -> bool new in Git master
Convert a set of 2D image levels to a file.
auto convertToFile(std::initializer_list<ImageView2D> imageLevels, Containers::StringView filename) -> bool new in Git master
auto convertToFile(Containers::ArrayView<const ImageView3D> imageLevels, Containers::StringView filename) -> bool new in Git master
Convert a set of 3D image levels to a file.
auto convertToFile(std::initializer_list<ImageView3D> imageLevels, Containers::StringView filename) -> bool new in Git master
auto convertToFile(Containers::ArrayView<const CompressedImageView1D> imageLevels, Containers::StringView filename) -> bool new in Git master
Convert a set of compressed 1D image levels to a file.
auto convertToFile(std::initializer_list<CompressedImageView1D> imageLevels, Containers::StringView filename) -> bool new in Git master
auto convertToFile(Containers::ArrayView<const CompressedImageView2D> imageLevels, Containers::StringView filename) -> bool new in Git master
Convert a set of compressed 2D image levels to a file.
auto convertToFile(std::initializer_list<CompressedImageView2D> imageLevels, Containers::StringView filename) -> bool new in Git master
auto convertToFile(Containers::ArrayView<const CompressedImageView3D> imageLevels, Containers::StringView filename) -> bool new in Git master
Convert a set of compressed 3D image levels to a file.
auto convertToFile(std::initializer_list<CompressedImageView3D> imageLevels, Containers::StringView filename) -> bool new in Git master

Protected functions

auto doConvertToFile(const ImageView1D& image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(const ImageView1D&, Containers::StringView)
auto doConvertToFile(const ImageView2D& image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(const ImageView2D&, Containers::StringView)
auto doConvertToFile(const ImageView3D& image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(const ImageView3D&, Containers::StringView)
auto doConvertToFile(const CompressedImageView1D& image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(const CompressedImageView1D&, Containers::StringView)
auto doConvertToFile(const CompressedImageView2D& image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(const CompressedImageView2D&, Containers::StringView)
auto doConvertToFile(const CompressedImageView3D& image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(const CompressedImageView3D&, Containers::StringView)
auto doConvertToFile(Containers::ArrayView<const ImageView1D> imageLevels, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(Containers::ArrayView<const ImageView1D>, Containers::StringView)
auto doConvertToFile(Containers::ArrayView<const ImageView2D> imageLevels, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(Containers::ArrayView<const ImageView2D>, Containers::StringView)
auto doConvertToFile(Containers::ArrayView<const ImageView3D> imageLevels, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(Containers::ArrayView<const ImageView3D>, Containers::StringView)
auto doConvertToFile(Containers::ArrayView<const CompressedImageView1D> image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(Containers::ArrayView<const CompressedImageView1D>, Containers::StringView)
auto doConvertToFile(Containers::ArrayView<const CompressedImageView2D> image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(Containers::ArrayView<const CompressedImageView2D>, Containers::StringView)
auto doConvertToFile(Containers::ArrayView<const CompressedImageView3D> image, Containers::StringView filename) -> bool virtual new in Git master
Implementation for convertToFile(Containers::ArrayView<const CompressedImageView3D>, Containers::StringView)

Private functions

auto doFeatures() const -> ImageConverterFeatures pure virtual
Implementation for features()
void doSetFlags(ImageConverterFlags flags) virtual new in 2020.06
Implementation for setFlags()
auto doExtension() const -> Containers::String virtual new in Git master
Implementation for extension()
auto doMimeType() const -> Containers::String virtual new in Git master
Implementation for mimeType()
auto doConvert(const ImageView1D& image) -> Containers::Optional<ImageData1D> virtual new in Git master
Implementation for convert(const ImageView1D&)
auto doConvert(const ImageView2D& image) -> Containers::Optional<ImageData2D> virtual new in Git master
Implementation for convert(const ImageView2D&)
auto doConvert(const ImageView3D& image) -> Containers::Optional<ImageData3D> virtual new in Git master
Implementation for convert(const ImageView3D&)
auto doConvert(const CompressedImageView1D& image) -> Containers::Optional<ImageData1D> virtual new in Git master
Implementation for convert(const CompressedImageView1D&)
auto doConvert(const CompressedImageView2D& image) -> Containers::Optional<ImageData2D> virtual new in Git master
Implementation for convert(const CompressedImageView2D&)
auto doConvert(const CompressedImageView3D& image) -> Containers::Optional<ImageData3D> virtual new in Git master
Implementation for convert(const CompressedImageView3D&)
auto doConvertToData(const ImageView1D& image) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(const ImageView1D&)
auto doConvertToData(const ImageView2D& image) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(const ImageView2D&)
auto doConvertToData(const ImageView3D& image) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(const ImageView3D&)
auto doConvertToData(const CompressedImageView1D& image) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(const CompressedImageView1D&)
auto doConvertToData(const CompressedImageView2D& image) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(const CompressedImageView2D&)
auto doConvertToData(const CompressedImageView3D& image) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(const CompressedImageView3D&)
auto doConvertToData(Containers::ArrayView<const ImageView1D> imageLevels) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(Containers::ArrayView<const ImageView1D>)
auto doConvertToData(Containers::ArrayView<const ImageView2D> imageLevels) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(Containers::ArrayView<const ImageView2D>)
auto doConvertToData(Containers::ArrayView<const ImageView3D> imageLevels) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(Containers::ArrayView<const ImageView3D>)
auto doConvertToData(Containers::ArrayView<const CompressedImageView1D> imageLevels) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(Containers::ArrayView<const CompressedImageView1D>)
auto doConvertToData(Containers::ArrayView<const CompressedImageView2D> imageLevels) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(Containers::ArrayView<const CompressedImageView2D>)
auto doConvertToData(Containers::ArrayView<const CompressedImageView3D> imageLevels) -> Containers::Optional<Containers::Array<char>> virtual new in Git master
Implementation for convertToData(Containers::ArrayView<const CompressedImageView3D>)

Typedef documentation

typedef ImageConverterFeature Magnum::Trade::AbstractImageConverter::Feature

Features supported by an image converter.

typedef ImageConverterFeatures Magnum::Trade::AbstractImageConverter::Features

Features supported by an image converter.

Function documentation

static Containers::StringView Magnum::Trade::AbstractImageConverter::pluginInterface()

Plugin interface.

"cz.mosra.magnum.Trade.AbstractImageConverter/0.3.3"

static Containers::Array<Containers::String> Magnum::Trade::AbstractImageConverter::pluginSearchPaths()

Plugin search paths.

Looks into magnum/imageconverters/ or magnum-d/imageconverters/ next to the dynamic Trade library, next to the executable and elsewhere according to the rules documented in Corrade::PluginManager::implicitPluginSearchPaths(). The search directory can be also hardcoded using the MAGNUM_PLUGINS_DIR CMake variables, see Downloading and building for more information.

Not defined on platforms without dynamic plugin support.

void Magnum::Trade::AbstractImageConverter::setFlags(ImageConverterFlags flags) new in 2020.06

Set converter flags.

Some flags can be set only if the converter supports particular features, see documentation of each ImageConverterFlag for more information. By default no flags are set. To avoid clearing potential future default flags by accident, prefer to use addFlags() and clearFlags() instead.

Corresponds to the -v / --verbose option in magnum-imageconverter.

void Magnum::Trade::AbstractImageConverter::addFlags(ImageConverterFlags flags) new in Git master

Add converter flags.

Calls setFlags() with the existing flags ORed with flags. Useful for preserving the defaults.

void Magnum::Trade::AbstractImageConverter::clearFlags(ImageConverterFlags flags) new in Git master

Clear converter flags.

Calls setFlags() with the existing flags ANDed with inverse of flags. Useful for removing default flags.

Containers::String Magnum::Trade::AbstractImageConverter::extension() const new in Git master

File extension.

Available only if ImageConverterFeature::Convert*ToFile or ImageConverterFeature::Convert*ToData is supported. Returns a standardized file extension corresponding to the file format used, such as "png" for PNG files. If the file format doesn't have a standardized extension, empty string is returned.

The returned value may depend on flags or configuration options and can change during plugin lifetime.

Containers::String Magnum::Trade::AbstractImageConverter::mimeType() const new in Git master

File MIME type.

Available only if ImageConverterFeature::Convert*ToFile or ImageConverterFeature::Convert*ToData is supported. Returns a standardized MIME type corresponding to the file format used, such as "image/png" for PNG files. If the file format doesn't have a standardized MIME type, empty string is returned.

The returned value may depend on flags or configuration options and can change during plugin lifetime.

Containers::Optional<ImageData1D> Magnum::Trade::AbstractImageConverter::convert(const ImageView1D& image) new in Git master

Convert a 1D image.

Available only if ImageConverterFeature::Convert1D is supported. On failure prints a message to Error and returns Containers::NullOpt. The implementation is allowed to return both a compressed and an uncompressed image, see documentation of a particular converter for more information.

Containers::Optional<ImageData2D> Magnum::Trade::AbstractImageConverter::convert(const ImageView2D& image) new in Git master

Convert a 2D image.

Available only if ImageConverterFeature::Convert2D is supported. On failure prints a message to Error and returns Containers::NullOpt. The implementation is allowed to return both a compressed and an uncompressed image, see documentation of a particular converter for more information.

Containers::Optional<Image2D> Magnum::Trade::AbstractImageConverter::exportToImage(const ImageView2D& image)

Convert a 2D image.

Containers::Optional<CompressedImage2D> Magnum::Trade::AbstractImageConverter::exportToCompressedImage(const ImageView2D& image)

Convert a 2D image to compressed format.

Containers::Optional<ImageData3D> Magnum::Trade::AbstractImageConverter::convert(const ImageView3D& image) new in Git master

Convert a 3D image.

Available only if ImageConverterFeature::Convert3D is supported. On failure prints a message to Error and returns Containers::NullOpt. The implementation is allowed to return both a compressed and an uncompressed image, see documentation of a particular converter for more information.

Containers::Optional<ImageData1D> Magnum::Trade::AbstractImageConverter::convert(const CompressedImageView1D& image) new in Git master

Convert a compressed 1D image.

Available only if ImageConverterFeature::ConvertCompressed1D is supported. On failure prints a message to Error and returns Containers::NullOpt. The implementation is allowed to return both a compressed and an uncompressed image, see documentation of a particular converter for more information.

Containers::Optional<ImageData2D> Magnum::Trade::AbstractImageConverter::convert(const CompressedImageView2D& image) new in Git master

Convert a compressed 2D image.

Available only if ImageConverterFeature::ConvertCompressed2D is supported. On failure prints a message to Error and returns Containers::NullOpt. The implementation is allowed to return both a compressed and an uncompressed image, see documentation of a particular converter for more information.

Containers::Optional<ImageData3D> Magnum::Trade::AbstractImageConverter::convert(const CompressedImageView3D& image) new in Git master

Convert a compressed 3D image.

Available only if ImageConverterFeature::ConvertCompressed3D is supported. On failure prints a message to Error and returns Containers::NullOpt. The implementation is allowed to return both a compressed and an uncompressed image, see documentation of a particular converter for more information.

Containers::Optional<ImageData1D> Magnum::Trade::AbstractImageConverter::convert(const ImageData1D& image) new in Git master

Convert a 1D image data.

Based on whether the image is compressed or not, calls either convert(const ImageView1D&) or convert(const CompressedImageView1D&). See documentation of these two functions for details.

This overload is not provided for multi-level conversion as the view list creation can be done more optimally on the application side.

Containers::Optional<ImageData2D> Magnum::Trade::AbstractImageConverter::convert(const ImageData2D& image) new in Git master

Convert a 2D image data.

Based on whether the image is compressed or not, calls either convert(const ImageView2D&) or convert(const CompressedImageView2D&). See documentation of these two functions for details.

This overload is not provided for multi-level conversion as the view list creation can be done more optimally on the application side.

Containers::Optional<ImageData3D> Magnum::Trade::AbstractImageConverter::convert(const ImageData3D& image) new in Git master

Convert a 3D image data.

Based on whether the image is compressed or not, calls either convert(const ImageView3D&) or convert(const CompressedImageView3D&). See documentation of these two functions for details.

This overload is not provided for multi-level conversion as the view list creation can be done more optimally on the application side.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const ImageView1D& image) new in Git master

Convert a 1D image to a raw data.

Available only if ImageConverterFeature::Convert1DToData is supported. The image view is expected to not be nullptr and to have a non-zero size. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const ImageView2D& image) new in Git master

Convert a 2D image to a raw data.

Available only if ImageConverterFeature::Convert2DToData is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Array<char> Magnum::Trade::AbstractImageConverter::exportToData(const ImageView2D& image)

Convert a 2D image to a raw data.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const ImageView3D& image) new in Git master

Convert a 3D image to a raw data.

Available only if ImageConverterFeature::Convert3DToData is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const CompressedImageView1D& image) new in Git master

Convert a compressed 1D image to a raw data.

Available only if ImageConverterFeature::ConvertCompressed1DToData is supported. The image view is expected to not be nullptr and to have a non-zero size. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const CompressedImageView2D& image) new in Git master

Convert a compressed 2D image to a raw data.

Available only if ImageConverterFeature::ConvertCompressed2DToData is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Array<char> Magnum::Trade::AbstractImageConverter::exportToData(const CompressedImageView2D& image)

Convert a compressed 2D image to a raw data.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const CompressedImageView3D& image) new in Git master

Convert a compressed 3D image to a raw data.

Available only if ImageConverterFeature::ConvertCompressed3DToData is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const ImageData1D& image) new in Git master

Convert a 1D image data to a raw data.

Based on whether the image is compressed or not, calls either convertToData(const ImageView1D&) or convertToData(const CompressedImageView1D&). See documentation of these two functions for details.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const ImageData2D& image) new in Git master

Convert a 2D image data to a raw data.

Based on whether the image is compressed or not, calls either convertToData(const ImageView2D&) or convertToData(const CompressedImageView2D&). See documentation of these two functions for details.

Containers::Array<char> Magnum::Trade::AbstractImageConverter::exportToData(const ImageData2D& image)

Convert a 2D image data to a raw data.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(const ImageData3D& image) new in Git master

Convert a 3D image data to a raw data.

Based on whether the image is compressed or not, calls either convertToData(const ImageView3D&) or convertToData(const CompressedImageView3D&). See documentation of these two functions for details.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(Containers::ArrayView<const ImageView1D> imageLevels) new in Git master

Convert a set of 1D image levels to a raw data.

Available only if ImageConverterFeature::Levels together with Convert1DToData is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size, and all of them sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(std::initializer_list<ImageView1D> imageLevels) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(Containers::ArrayView<const ImageView2D> imageLevels) new in Git master

Convert a set of 2D image levels to a raw data.

Available only if ImageConverterFeature::Levels together with Convert2DToData is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(std::initializer_list<ImageView2D> imageLevels) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(Containers::ArrayView<const ImageView3D> imageLevels) new in Git master

Convert a set of 3D image levels to a raw data.

Available only if ImageConverterFeature::Levels together with Convert3DToData is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(std::initializer_list<ImageView3D> imageLevels) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(Containers::ArrayView<const CompressedImageView1D> imageLevels) new in Git master

Convert a set of compressed 1D image levels to a raw data.

Available only if ImageConverterFeature::Levels together with ConvertCompressed1DToData is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(std::initializer_list<CompressedImageView1D> imageLevels) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(Containers::ArrayView<const CompressedImageView2D> imageLevels) new in Git master

Convert a set of compressed 2D image levels to a raw data.

Available only if ImageConverterFeature::Levels together with ConvertCompressed2DToData is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(std::initializer_list<CompressedImageView2D> imageLevels) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(Containers::ArrayView<const CompressedImageView3D> images) new in Git master

Convert a set of compressed 3D image levels to a raw data.

Available only if ImageConverterFeature::Levels together with ConvertCompressed3DToData is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns Containers::NullOpt.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::convertToData(std::initializer_list<CompressedImageView3D> images) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const ImageView1D& image, Containers::StringView filename) new in Git master

Convert a 1D image to a file.

Available only if ImageConverterFeature::Convert1DToFile is supported. The image view is expected to not be nullptr and to have a non-zero size. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const ImageView2D& image, Containers::StringView filename) new in Git master

Convert a 2D image to a file.

Available only if ImageConverterFeature::Convert2DToFile is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. Returns true on success, false otherwise.

bool Magnum::Trade::AbstractImageConverter::exportToFile(const ImageView2D& image, const std::string& filename)

Convert a 2D image to a file.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const ImageView3D& image, Containers::StringView filename) new in Git master

Convert a 3D image to a file.

Available only if ImageConverterFeature::Convert3DToFile is supported. The image view is expected to not be nullptr and to have a non-zero size. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const CompressedImageView1D& image, Containers::StringView filename) new in Git master

Convert a compressed 1D image to a file.

Available only if ImageConverterFeature::ConvertCompressed1DToFile is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const CompressedImageView2D& image, Containers::StringView filename) new in Git master

Convert a compressed 2D image to a file.

Available only if ImageConverterFeature::ConvertCompressed2DToFile is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::exportToFile(const CompressedImageView2D& image, const std::string& filename)

Convert a compressed 2D image to a file.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const CompressedImageView3D& image, Containers::StringView filename) new in Git master

Convert a compressed 3D image to a file.

Available only if ImageConverterFeature::ConvertCompressed3DToFile is supported. The image view is expected to not be nullptr and to have a non-zero size in all dimensions. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const ImageData1D& image, Containers::StringView filename) new in Git master

Convert a 1D image data to a file.

Based on whether the image is compressed or not, calls either convertToFile(const ImageView1D&, Containers::StringView) or convertToFile(const CompressedImageView1D&, Containers::StringView). See documentation of these two functions for details.

This overload is not provided for multi-level conversion as the view list creation can be done more optimally on the application side.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const ImageData2D& image, Containers::StringView filename) new in Git master

Convert a 2D image data to a file.

Based on whether the image is compressed or not, calls either convertToFile(const ImageView2D&, Containers::StringView) or convertToFile(const CompressedImageView2D&, Containers::StringView). See documentation of these two functions for details.

This overload is not provided for multi-level conversion as the view list creation can be done more optimally on the application side.

bool Magnum::Trade::AbstractImageConverter::exportToFile(const ImageData2D& image, const std::string& filename)

Convert a 2D image data to a file.

bool Magnum::Trade::AbstractImageConverter::convertToFile(const ImageData3D& image, Containers::StringView filename) new in Git master

Convert a 3D image data to a file.

Based on whether the image is compressed or not, calls either convertToFile(const ImageView3D&, Containers::StringView) or convertToFile(const CompressedImageView3D&, Containers::StringView). See documentation of these two functions for details.

This overload is not provided for multi-level conversion as the view list creation can be done more optimally on the application side.

bool Magnum::Trade::AbstractImageConverter::convertToFile(Containers::ArrayView<const ImageView1D> imageLevels, Containers::StringView filename) new in Git master

Convert a set of 1D image levels to a file.

Available only if ImageConverterFeature::Levels together with Convert1DToFile is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(std::initializer_list<ImageView1D> imageLevels, Containers::StringView filename) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::convertToFile(Containers::ArrayView<const ImageView2D> imageLevels, Containers::StringView filename) new in Git master

Convert a set of 2D image levels to a file.

Available only if ImageConverterFeature::Levels together with Convert2DToFile is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(std::initializer_list<ImageView2D> imageLevels, Containers::StringView filename) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::convertToFile(Containers::ArrayView<const ImageView3D> imageLevels, Containers::StringView filename) new in Git master

Convert a set of 3D image levels to a file.

Available only if ImageConverterFeature::Levels together with Convert3DToFile is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(std::initializer_list<ImageView3D> imageLevels, Containers::StringView filename) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::convertToFile(Containers::ArrayView<const CompressedImageView1D> imageLevels, Containers::StringView filename) new in Git master

Convert a set of compressed 1D image levels to a file.

Available only if ImageConverterFeature::Levels together with ConvertCompressed1DToFile is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(std::initializer_list<CompressedImageView1D> imageLevels, Containers::StringView filename) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::convertToFile(Containers::ArrayView<const CompressedImageView2D> imageLevels, Containers::StringView filename) new in Git master

Convert a set of compressed 2D image levels to a file.

Available only if ImageConverterFeature::Levels together with ConvertCompressed2DToFile is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(std::initializer_list<CompressedImageView2D> imageLevels, Containers::StringView filename) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::convertToFile(Containers::ArrayView<const CompressedImageView3D> imageLevels, Containers::StringView filename) new in Git master

Convert a set of compressed 3D image levels to a file.

Available only if ImageConverterFeature::Levels together with ConvertCompressed3DToFile is supported. The function expects at least one image to be passed, with each view expected to not be nullptr, to have a non-zero size in all dimensions, and all views sharing the same pixel format and layout flags. Note that certain converters may impose additional size and order restrictions on the images, see documentation of a particular plugin for more information. On failure prints a message to Error and returns false.

bool Magnum::Trade::AbstractImageConverter::convertToFile(std::initializer_list<CompressedImageView3D> imageLevels, Containers::StringView filename) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(const ImageView1D& image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(const ImageView1D&, Containers::StringView)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToFile(Containers::ArrayView<const ImageView1D>, Containers::StringView) with just the single image. Otherwise, if ImageConverterFeature::Convert1DToData is supported, default implementation calls doConvertToData(const ImageView1D&) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(const ImageView2D& image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(const ImageView2D&, Containers::StringView)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToFile(Containers::ArrayView<const ImageView2D>, Containers::StringView) with just the single image. Otherwise, if ImageConverterFeature::Convert2DToData is supported, default implementation calls doConvertToData(const ImageView2D&) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(const ImageView3D& image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(const ImageView3D&, Containers::StringView)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToFile(Containers::ArrayView<const ImageView3D>, Containers::StringView) with just the single image. Otherwise, if ImageConverterFeature::Convert3DToData is supported, default implementation calls doConvertToData(const ImageView3D&) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(const CompressedImageView1D& image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(const CompressedImageView1D&, Containers::StringView)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToFile(Containers::ArrayView<const CompressedImageView1D>, Containers::StringView) with just the single image. Otherwise, if ImageConverterFeature::ConvertCompressed1DToData is supported, default implementation calls doConvertToData(const CompressedImageView1D&) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(const CompressedImageView2D& image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(const CompressedImageView2D&, Containers::StringView)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToFile(Containers::ArrayView<const CompressedImageView2D>, Containers::StringView) with just the single image. Otherwise, if ImageConverterFeature::ConvertCompressed2DToData is supported, default implementation calls doConvertToData(const CompressedImageView2D&) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(const CompressedImageView3D& image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(const CompressedImageView3D&, Containers::StringView)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToFile(Containers::ArrayView<const CompressedImageView3D>, Containers::StringView) with just the single image. Otherwise, if ImageConverterFeature::ConvertCompressed3DToData is supported, default implementation calls doConvertToData(const CompressedImageView3D&) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(Containers::ArrayView<const ImageView1D> imageLevels, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(Containers::ArrayView<const ImageView1D>, Containers::StringView)

If ImageConverterFeature::Convert1DToData is supported, default implementation calls doConvertToData(Containers::ArrayView<const ImageView1D>) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(Containers::ArrayView<const ImageView2D> imageLevels, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(Containers::ArrayView<const ImageView2D>, Containers::StringView)

If ImageConverterFeature::Convert2DToData is supported, default implementation calls doConvertToData(Containers::ArrayView<const ImageView2D>) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(Containers::ArrayView<const ImageView3D> imageLevels, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(Containers::ArrayView<const ImageView3D>, Containers::StringView)

If ImageConverterFeature::Convert3DToData is supported, default implementation calls doConvertToData(Containers::ArrayView<const ImageView3D>) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(Containers::ArrayView<const CompressedImageView1D> image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(Containers::ArrayView<const CompressedImageView1D>, Containers::StringView)

If ImageConverterFeature::ConvertCompressed1DToData is supported, default implementation calls doConvertToData(Containers::ArrayView<const CompressedImageView1D>) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(Containers::ArrayView<const CompressedImageView2D> image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(Containers::ArrayView<const CompressedImageView2D>, Containers::StringView)

If ImageConverterFeature::ConvertCompressed2DToData is supported, default implementation calls doConvertToData(Containers::ArrayView<const CompressedImageView2D>) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

bool Magnum::Trade::AbstractImageConverter::doConvertToFile(Containers::ArrayView<const CompressedImageView3D> image, Containers::StringView filename) virtual protected new in Git master

Implementation for convertToFile(Containers::ArrayView<const CompressedImageView3D>, Containers::StringView)

If ImageConverterFeature::ConvertCompressed3DToData is supported, default implementation calls doConvertToData(Containers::ArrayView<const CompressedImageView3D>) and saves the result to given file. It is allowed to call this function from your doConvertToFile() implementation, for example when you only need to do format detection based on file extension.

void Magnum::Trade::AbstractImageConverter::doSetFlags(ImageConverterFlags flags) virtual private new in 2020.06

Implementation for setFlags()

Useful when the converter needs to modify some internal state on flag setup. Default implementation does nothing and this function doesn't need to be implemented — the flags are available through flags().

To reduce the amount of error checking on user side, this function isn't expected to fail — if a flag combination is invalid / unsuported, error reporting should be delayed to various conversion functions, where the user is expected to do error handling anyway.

Containers::String Magnum::Trade::AbstractImageConverter::doExtension() const virtual private new in Git master

Implementation for extension()

Default implementation returns an empty string.

Containers::String Magnum::Trade::AbstractImageConverter::doMimeType() const virtual private new in Git master

Implementation for mimeType()

Default implementation returns an empty string.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::doConvertToData(const ImageView1D& image) virtual private new in Git master

Implementation for convertToData(const ImageView1D&)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToData(Containers::ArrayView<const ImageView1D>) with just the single image and propagates the result back.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::doConvertToData(const ImageView2D& image) virtual private new in Git master

Implementation for convertToData(const ImageView2D&)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToData(Containers::ArrayView<const ImageView2D>) with just the single image and propagates the result back.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::doConvertToData(const ImageView3D& image) virtual private new in Git master

Implementation for convertToData(const ImageView3D&)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToData(Containers::ArrayView<const ImageView3D>) with just the single image and propagates the result back.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::doConvertToData(const CompressedImageView1D& image) virtual private new in Git master

Implementation for convertToData(const CompressedImageView1D&)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToData(Containers::ArrayView<const CompressedImageView1D>) with just the single image and propagates the result back.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::doConvertToData(const CompressedImageView2D& image) virtual private new in Git master

Implementation for convertToData(const CompressedImageView2D&)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToData(Containers::ArrayView<const CompressedImageView2D>) with just the single image and propagates the result back.

Containers::Optional<Containers::Array<char>> Magnum::Trade::AbstractImageConverter::doConvertToData(const CompressedImageView3D& image) virtual private new in Git master

Implementation for convertToData(const CompressedImageView3D&)

If ImageConverterFeature::Levels is supported, default implementation calls doConvertToData(Containers::ArrayView<const CompressedImageView3D>) with just the single image and propagates the result back.