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

WebP importer plugin.

Imports WebP (*.webp) RGB and RGBA images using the libwebp library. You can use WebPImageConverter to encode images into this format.

Usage

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

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following. Using libwebp 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_WEBPIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL)

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

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

find_package(MagnumPlugins REQUIRED WebPImporter)

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

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

Behavior and limitations

WebP only supports 24-bit RGB color with an optional 8-bit alpha channel, which is imported as either PixelFormat::RGB8Unorm or PixelFormat::RGBA8Unorm. It doesn't have a special colorspace for grayscale, those are encoded the same way as RGB.

The importer doesn't support decoding of animated WebP files.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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