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

OpenEXR image converter plugin.

Creates OpenEXR (*.exr) files from images with PixelFormat::R16F / RG16F / RGB16F / RGBA16F, PixelFormat::R32F / RG32F / RGB32F / RGBA32F or PixelFormat::R32UI / RG32UI / RGB32UI / RGBA32UI and PixelFormat::Depth32F. You can use OpenExrImporter to import images in this format.

Usage

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

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

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

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

find_package(MagnumPlugins REQUIRED OpenExrImageConverter)

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

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

Behavior and limitations

Channel mapping

Images with PixelFormat::R16F / RG16F / RGB16F / RGBA16F, PixelFormat::R32F / RG32F / RGB32F / RGBA32F or PixelFormat::R32UI / RG32UI / RGB32UI / RGBA32UI are implicitly written to channels named R, G, B and A; images with PixelFormat::Depth32F are implicitly written to a Z channel.

If the default behavior is not sufficient, custom channel mapping can be supplied in the configuration.

Multilayer and multipart images

Channels can be prefixed with a custom layer name by specifying the layer configuration option. Combining multiple layers into a single image isn't supported right now, writing multiple images into a multipart file is not supported either.

Cube map, environment map and deep images

Creating deep images is not supported right now, cube map and environment map images can be only written from a two-dimensional input, however there's currently no way to mark them properly in the metadata.

Plugin-specific configuration

It's possible to tune various options mainly for channel mapping through configuration(). See below for all options and their default values:

[configuration]
# Save channels with given layer
layer=

# Map R/RG/RGB/RGBA image channels to given channel names. If the image is in a
# PixelFormat::Depth32F, depth is used instead. If the channel is not present
# in the input or if its name is empty, it's not written to the file.
r=R
g=G
b=B
a=A
depth=Z

# Display and data window. OpenEXR allows the image to annotate a crop border
# or specify that the data are just a small portion of a bigger image. The
# display window is a four-component vector with (inclusive) Xmin, Ymin, Xmax,
# Ymax coordinates. If left empty, it's implicitly set to 0 0 width-1 height-1.
# The data window size is always set to width-1 height-1 and you can only set
# the offset. For details see the pixel space, Display Window and Data Window
# chapter of https://www.openexr.com/documentation/TechnicalIntroduction.pdf .
displayWindow=
dataOffset=0 0

# Compression. Allowed values are rle, zip, zips, piz, pxr24, b44, b44a, dwaa
# and dwab; leave it empty to write the output uncompressed. Details about
# particular compression algorithms are in the Data Compression chapter of
# https://www.openexr.com/documentation/TechnicalIntroduction.pdf .
compression=zip

Base classes

class AbstractImageConverter
Base for image converter plugins.

Constructors, destructors, conversion operators

OpenExrImageConverter(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.