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

KTX2 image converter plugin.

Creates Khronos Texture 2.0 (*.ktx2) files from 1D, 2D and 3D images with optional mip levels. You can use KtxImporter to import images in this format.

Usage

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

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins and do the following:

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

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

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

find_package(MagnumPlugins REQUIRED KtxImageConverter)

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

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

Behavior and limitations

Supported formats

The following formats can be written:

Cube map and array images

Cube map and array images can be written but there is currently no way to mark them properly in the metadata. Exported files will be 3D images with cube map faces and array layers exposed as depth slices.

Multilevel images

All image types can be saved with multiple levels by using the list variants of convertToFile() / convertToData(). Largest level is expected to be first, with each following level having width and height divided by two, rounded down. Incomplete mip chains are supported.

Supercompression

Saving files with supercompression is not supported.

Plugin-specific configuration

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

[configuration]
# Orientation string to save in the file header. This doesn't flip the input
# pixels, it only tells readers the orientation during import. Must be empty or
# a string of the form [rl][du][oi]:
#   r/l: right/left
#   d/u: down/up
#   # o/i: out of/into the screen
# Only subsets of rdi and ruo are recommended, other values may not be
# supported by all readers.
orientation=ruo

# Format swizzle string to save in the file header. This doesn't save swizzled
# data, it only tells readers the desired channel mapping during import. Must
# be empty or 4 characters long, valid characters are r,g,b,a,0,1.
swizzle=

# Name of the tool writing the image file, saved in the file header
writerName=Magnum KtxImageConverter

See Editing plugin-specific configuration for more information and an example showing how to edit the configuration values.

Base classes

class AbstractImageConverter
Base for image converter plugins.

Constructors, destructors, conversion operators

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