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

KTX2 image converter plugin.

Creates Khronos Texture 2.0 (*.ktx2) files. You can use KtxImporter to import images in this format.

Usage

This plugin depends on the Trade library and is built if MAGNUM_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(MAGNUM_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

Accepts 1D, 1D array, 2D, 2D array, cube map and cube map array images, recognizing ImageFlag2D::Array, ImageFlag3D::Array and/or ImageFlag3D::CubeMap in passed images. The following formats can be written:

The plugin recognizes ImageConverterFlag::Quiet, which will cause all conversion warnings to be suppressed.

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, 1D, 2D and 3D images then have each following level having width, height and depth divided by two, rounded down. Array and cube map images differ in that they don't shrink along the last dimension. Incomplete mip chains are supported.

Supercompression

Saving files with supercompression is not supported. You can however use BasisImageConverter to create Basis-supercompressed KTX2 files.

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. The file gets a prefix of the string based on
# dimension count, for array and cube map images the last dimension doesn't
# specify any orientation.
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 rgba01.
swizzle=

# Generator name, saved as the KTXwriter property in the KTX file header. If
# empty, no value is written. The {0} placeholder, if present, will be
# replaced with Corrade, Magnum and Magnum Plugins version info including Git
# commit hashes if the plugin is built in Release from a non-sparse Git
# clone.
generator=Magnum KtxImageConverter {0}

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 Containers::StringView& plugin) explicit
Plugin manager constructor.