Magnum::Trade::JpegImporter class

JPEG importer plugin.

Imports JPEG (*.jpg, *.jpe, *.jpeg) using the libJPEG library. You can use JpegImageConverter to encode images into this format.

Usage

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

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

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

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

find_package(MagnumPlugins REQUIRED JpegImporter)

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

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

Behavior and limitations

The images are imported with PixelFormat::RGB8Unorm or PixelFormat::R8Unorm. All imported images use default PixelStorage parameters.

libJPEG implementations

While some systems (such as macOS) still ship only with the vanilla libJPEG, you can get a much better decoding performance by using libjpeg-turbo.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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