An apng image plugin for Qt to support animated PNGs
apng image plugin for Qt to support animated PNGs
Enable the usage of apng images with Qt. The plugin adds the apng format as a new format for any Qt application, and thus supports loading of apng images via QMovie
, AnimatedImage
and other types.
To build the plugin, libpng with the apng patch applied is required. By default the libpng provided by pkg-config
is used for unix-like systems. If the library is not available, the project will compile a static library of libpng and embed it into the plugin. You can force this behaviour by running qmake with CONFIG += libpng_static
The project comes with a version of zlib and libpng (with the apng patch). They can be found in the src/3rdparty
subfolder. They are automatically compiled into static libraries and used to link the apng plugin when neccessary. Please note that both libraries are compiled without any optimizations for architecture etc. If you wish to have those features, you can replace those two by your own versions.
Project | Version | License | Project page |
---|---|---|---|
zlib | 1.2.11 | zlib-license | https://www.zlib.net/ |
libpng | 1.6.37 | libpng-license | http://www.libpng.org/pub/png/libpng.html |
apng patch | 1.6.37 | libpng-license | https://sourceforge.net/projects/libpng-apng/ |
qt5-apng-plugin
/path/to/MaintenanceTool --addTempRepository <url>
with one of the following urls (GUI-Method is currently broken, see QTIFW-1156) - This must be done every time you start the tool:
Qt > Qt 5.11 > Skycoder42 Qt modules
)Qt Apng Image Plugin
git clone
or download from the releases. If you choose the second option, you have to manually create a folder named .git
in the projects root directory, otherwise the build will fail.qmake
make
(If you want the tests/examples/etc. run make all
)make install
Simply use the default Qt classes like QImageReader
, QMovie
etc. and open the apng files just like you would open normal images/animations (like gif files)
Format Detection:
Since the png format is already used by Qt, *.png
files will not use the plugin. To load a png as animated, you can either rename the file to *.apng
, or set the format explicitly
QMovie movie("path/to/image.png", "apng");