[Interest] APNG support for QImageReader

Konstantin Tokarev annulen at yandex.ru
Thu Aug 17 13:11:19 CEST 2017

17.08.2017, 11:54, "Bennett Ramirez" <bennett.ramirez at gmail.com>:
> Hello,
> I am the current maintainer for a very niche game that works kind of
> like an animated chatroom. After having been transferred the rights to
> the project by its former maintainer, I have been receiving some
> grumbling from modders/content creators of the game due to the limiting
> nature of GIF - only 1-bit transparency, forced indexed colors,
> questionably ineffective compression, and so on.
> Since all of the assets of the game are essentially animated images, I
> have been shopping around for other well-endorsed animated image formats
> (including APNG, WebP, MNG, and just sticking to GIF), and concluded
> that APNG, while being somewhat nonstandard, is the best option for the
> game, as it gives the smallest file size (according to this site:
> http://littlesvr.ca/apng/gif_apng_webp.html), provides flexibility (in
> terms of the danger of losing color depth from dithering), and has
> relatively recently received support by the major desktop browsers.
> However, I haven't seen any talk at all of APNG support except in
> QtWebKit, but my game obviously does not use QtWebKit. I don't know
> about MNG support, as it's even less heard of than APNG and probably
> could get dropped support at any time; and I'm eyeing WebP since there
> is good support for it, although the larger size in animation would
> defeat the purpose of moving away from GIF. Perhaps WebM could be
> another alternative, but the animated images in question are all less
> than 15 frames per second and are anime-style line art, so I'm not sure
> how well WebM could be assured to keep the animation lossless. Moreover,
> it's not supported by QImageReader.
> So, I'm assuming that nobody has really ever needed to use APNG in their
> Qt project, and the people who needed APNG ended up building a
> full-fledged, in-house solution to the problem or used an external
> library. If this is the case, what is my recommended route for using
> high-quality/lossless animated images? Would the canonical solution be
> to just split all of the frames into PNG images, load them all in with
> some kind of sprite definition file, and then play them back as an
> animation? Would it even be justifiable, in this case, to create an
> original file format to handle these specific needs?
> Sorry if I ask too many questions. Thanks for your help.

It should not be too hard to implement QImageIOHandler for APNG.
See WebKit implementation for example [1], it works with regular libpng
library without any patches.

[1] http://code.qt.io/cgit/qt/qtwebkit.git/tree/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp?h=5.212 look for ENABLE(APNG)

> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


More information about the Interest mailing list