Qt Image Formats

The core Qt Gui library by default supports reading and writing image files of the most common file formats: PNG, JPEG, BMP, GIF and a few more, ref. Reading and Writing Image Files. The Qt Image Formats add-on module provides optional support for other image file formats.

The file format support is provided transparently, through plugins for Qt's image I/O system. As such, this module provides no API of its own. Instead, the functionality is accessed in the same way as other image I/O in Qt: through QImage::load() and QImage::save(). Or, for more detailed control, through QImageReader and QImageWriter.

The Image I/O Plugins

The actual coding and decoding of the file format is done by a codec library. The codec can be Qt or third party code. In case of a third party codec, the build process will look for it among the system libraries. If not found, it may fall back on using a bundled copy (in src/3rdparty).

Format Description Support 3rd Party Codec
DDS Direct Draw Surface Read/write No
ICNS Apple Icon Image Read/write No
JP2 Joint Photographic Experts Group 2000 Read/write Yes (bundled, unmaintained)
MNG Multiple-image Network Graphics Read Yes (bundled, unmaintained)
TGA Truevision Graphics Adapter Read No
TIFF Tagged Image File Format Read/write Yes (bundled)
WBMP Wireless Bitmap Read/write No
WEBP WebP Read/write Yes (bundled)

Note: Some bundled third party codecs are not maintained anymore. They are provided for manual builds only, and not used as a fallback in case system libraries are unavailable.

Deployment

When built, the Qt Image Formats plugins are located as dynamic libraries in the runtime plugin directory (typically plugins/imageformats), together with the default image format plugins. They may be deployed to the target system in the same way as other plugins, see the Deploying Plugins documentation.

Security considerations

Since these file formats are more rarely used, the codecs may be less thoroughly debugged against potential security holes. As always, care should be taken when creating applications that may be used to decode uncontrolled data files.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/archives/qt-5.6/qtimageformats-index.html