DevIL Image importer plugin.
Supports a large variety of image file types using the DevIL library, including (note that the list is incomplete):
- Windows Bitmap (
- Dr. Halo (
- Multi-PCX (
- Dicom (
- DirectDraw Surface (
- OpenEXR (
- Flexible Image Transport System (
- Heavy Metal: FAKK 2 (
- Graphics Interchange Format (
- Radiance HDR (
- Macintosh icon (
- Windows icon/cursor (
- Interchange File Format (
- Infinity Ward Image (
- JPEG (
- JPEG 2000 (
- Interlaced Bitmap (
- Homeworld texture (
- Half-Life Model (
- Multiple-image Network Graphics (
- MPEG-1 Audio Layer 3 (
- PaintShop Pro Palette (
- Halo Palette (
- Kodak PhotoCD (
- ZSoft PCX (
- Softimage PIC (
- Portable Network Graphics (
- Portable Anymap (
- Alias PIX (
- Adobe Photoshop (
- PaintShop Pro (
- Pixar (
- Raw data (
- Homeworld 2 Texture (
- Silicon Graphics (
- Creative Assembly Texture (
- Truevision TGA (
- Tagged Image File Format (
- Gamecube Texture (
- Unreal Texture (
- Quake 2 Texture (
- Valve Texture Format (
- HD Photo (
- X Pixel Map (
- Doom graphics
This plugins provides
This plugin depends on the Trade and DevIL libraries and is built if
WITH_DEVILIMAGEIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load
"DevIlImageImporter" via Corrade::
Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following. Using DevIL 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_TINYGLTFIMPORTER ON CACHE BOOL "" FORCE) add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL) # So the dynamically loaded plugin gets built implicitly add_dependencies(your-app MagnumPlugins::DevIlImageImporter)
To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake and FindDevIL.cmake into your
modules/ directory, request the
DevIlImageImporter component of the
MagnumPlugins package in CMake and link to the
find_package(MagnumPlugins REQUIRED DevIlImageImporter) # ... target_link_libraries(your-app PRIVATE MagnumPlugins::DevIlImageImporter)
The images are imported as PixelFormat::
1 if the data require it.
DDS files with BCn compression are always decompressed to RGBA on input.
Although DevIL advertises OpenEXR support, when trying any file it either complained about an invalid extension (
0x50b) or, when specifying
type=0x0442 in the configuration, failed with an invalid enum error (
0x501). Since DevIL internally uses OpenEXR anyway, you'll have a much better luck with OpenExrImporter.
In case the file is an animated GIF, the importer will report frame count in image2DCount() and you can then import each frame separately. Unfortunately, GIF transitions are not supported properly and some GIFs can fail to load or crash the library. See StbImageImporter for an alternative.
DevIL is able to load ICO files with embedded BMPs, unfortunately it crashes for some ICOs with embedded PNGs and doesn't correctly import alpha for others — use IcoImporter in that case instead. Note that for proper file format auto-detection you either need to load them via openFile() or set the
type configuration option to (hexadecimal)
0x0424. Compared to IcoImporter the icon sizes are reported as separate images instead of image levels.
Based on the source it seems that DevIL parses only the composited view, importing individual layers is not possible.
It's possible to tune various output options through configuration(). See below for all options and their default values:
[configuration] # Override file type when loading the file, one of the hexadecimal values from # https://github.com/DentonW/DevIL/blob/v1.8.0/DevIL/include/IL/il.h#L190-L244 # # By default set to 0, which is IL_TYPE_UNKNOWN. Useful with openData() and # formats that have no magic header and can be usually detected only from file # extension (such as *.ico or *.raw). type=0x0000
See Editing plugin-specific configuration for more information and an example showing how to edit the configuration values.
- class AbstractImporter
- Base for importer plugins.
- static void initialize()
- Initialize DevIL library.