Magnum::Trade::AvifImporter class new in Git master

AVIF importer plugin.

Imports AV1 Image File Format (*.avif) images using the libavif library.

Usage

This plugin depends on the Trade and libavif libraries and is built if MAGNUM_WITH_AVIFIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load "AvifImporter" via Corrade::PluginManager::Manager.

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following. Using libavif itself as a CMake subproject isn't tested at the moment, so you need to provide it as a system dependency and point CMAKE_PREFIX_PATH to its installation dir if necessary.

set(MAGNUM_WITH_AVIFIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL)

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

To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake into your modules/ directory, request the AvifImporter component of the MagnumPlugins package and link to the MagnumPlugins::AvifImporter target:

find_package(MagnumPlugins REQUIRED AvifImporter)

# ...
target_link_libraries(your-app PRIVATE MagnumPlugins::AvifImporter)

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

Behavior and limitations

Supports grayscale, grayscale+alpha, RGB and RGBA images with 8, 10 and 12 bits per channel. 10- and 12-bit images are expanded to 16 bits.

RGB images are imported as PixelFormat::RGB8Unorm / PixelFormat::RGB16Unorm and RGBA as PixelFormat::RGBA8Unorm / PixelFormat::RGBA16Unorm. Since version 1.3.0, libavif supports converting grayscale images as well, which are then imported as PixelFormat::R8Unorm / PixelFormat::R16Unorm and grayscale + alpha as PixelFormat::RG8Unorm / PixelFormat::RG16Unorm. On older versions they're imported as RGB and RGBA, respectively. All imported images use default PixelStorage parameters.

The importer always imports only the first image in the file, animation- and timing-related data are ignored.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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