High-quality animated image support



  • (I tried to send this to the Interest mailing list, but it was held for moderation and never approved. I suppose mailing lists are rather exclusive since most problems are best answered in the forums.)

    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.


    After a few days of research, I found that WebM can work losslessly and can go from PNG frames or GIF to WebM very easily via the ffmpeg CLI (and of course, there are many wrappers for the CLI out there), so I concluded that WebM would be a good alternative to use if APNG is not viable.

    I then found QtAV, but, assuming you read my original question, the library is rather overkill for the mere necessity of displaying high-quality animated images. We joked in the community Discord that I could add subtitles to the sprites if I wanted to!

    Now you hear the word "sprite," and the immediate, knee-jerk response is "game library." The problem is that we rely extensively on cross-platform UI widgets, and this is one of the primary offerings of Qt. Thus, while moving to something like SDL or SFML would be noble, it would make all of the UI functionality of the game (music controls, emote control, text boxes, etc.) very difficult to reimplement, and these control widgets already take up far more space than the animated chatroom widget itself.

    My choices, laid down, would be:

    • throw in QtAV, which looks almost like a drop-in replacement from the examples;
    • ask for APNG support in QImageReader;
    • ask modders who want high-quality animations to just split every single frame into a PNG file, create a sprite definition file of some kind, load in each and every one of those files into memory, and play it back as an animated sprite (the "conventional" route, but also the clunkiest - why should I redefine what an animated image is, if someone's already done it for me in some library or specification?); or
    • suck it up, and stick to GIF despite its detriments, because "that's what everyone uses for animated images anyway."

    Which choice of action would you recommend?


  • Moderators

    @oldmud0 said in High-quality animated image support:

    (I tried to send this to the Interest mailing list, but it was held for moderation and never approved. I suppose mailing lists are rather exclusive since most problems are best answered in the forums.)

    Qt mailing lists are not moderated. You just need to register and then your messages will be accepted right away.



  • Ah, so that's why it was never accepted. You see, the email Mailman sent back was a little cryptic, and instead of suggesting me to register, it simply suggested me to wait for approval by a moderator. But as you said, there's no review queue for unregistered users (the messages just get thrown away), so I wonder why it told me to wait. Regardless, I think this forum is a better place to get the question answered, but if there is no response within a week or so, I'll try sending it again to Interest. Thanks for your help.


  • Lifetime Qt Champion

    Hi,

    AFAIK, it's not a format supported officially however IIRC, mng is.

    I stumbled upon this patch that might be of interest to you.



  • @SGaist said in High-quality animated image support:

    Hi,

    AFAIK, it's not a format supported officially however IIRC, mng is.

    I stumbled upon this patch that might be of interest to you.

    Yes, I saw this patch. However, it's from 2013 - do you think it will still work? I guess there's only one way to find out...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.