GNOME Bugzilla – Bug 151281
add support for APNG (animated PNG) format
Last modified: 2018-12-01 18:51:26 UTC
APNG is intended to be a simple format for animated PNG images. It is intended to be a replacement for simple animated images that have traditionally used the GIF format, while adding support for 24-bit images and 8-bit transparency. APNG is intended to be a simple alternative to MNG, providing a very simple spec suitable for the most common usage of animated images. APNG is backwards-compatible with PNG; any PNG decoder is able to decode the first frame of an APNG and treat it as a normal single-frame PNG. Spec is here: http://www.vlad1.com/~vladimir/projects/apng/AnimatedPNG.html For a sample decoder, see the patch in http://bugzilla.mozilla.org/show_bug.cgi?id=257197 .
I'd rather see support for MNG-LC or another simple MNG profile, than yet another nonstandard png-based animation format. Whats wrong with MNG, apart from the reference library not supporting the 1-many animation-iterator model of gdk-pixbuf?
But that should not stop you from writing a gdk-pixbuf loader for APNG and ship it with the reference library. There _is_ a reference library, right ? Just make sure it doesn't completely take over decoding of png images.
Thierry: Please do *not* attempt to triage GTK+ bugs.
The APNG specification has been worked out and the implementation completed. It's been included in the Mozilla tree as a patch to libpng for a few months now. The new spec is here: http://wiki.mozilla.org/APNG_Specification The libpng patch is here: http://littlesvr.ca/apng/ I'll be more than happy to help add support for APNG to GTK (even though I've never done GTK dev work), if it would be accepted into the library once the work is complete. Otherwise I'd appreciate hearing why it won't be included and what I, or Mozilla, can do to mitigate that. I believe the PNG alpha channel is a most significant bonus to GTK because GTK is themed and it's practically impossible to fake anti-aliasing with animated GIFs.
Get the libpng patch upstream.
I started APNG support in a git-branch maintained on our Imendio server. It's almost done; see here: http://git.imendio.com/?p=projects/gtk%2B.git;a=shortlog;h=refs/heads/apng
I rebased the APNG branch to trunk yesterday and continued with development. Now APNG should be feature-complete and it even includes a testcase which compares decoded APNG frames with reference images. The branch also includes a jhbuild moduleset which will build libpng, glib and gtk+ (assuming you already have atk-dev and pango-dev installed on your system). To try this out, simply point jhbuild to this moduleset and build gtk+: http://git.imendio.com/?p=projects/gtk%2B.git;a=blob_plain;f=apng.modules;hb=apng It includes downloading libpng 1.2.25, the apng-patch for that version and will then build GTK+ against this version of libpng.
And again, I rebased the patch series to current gtk+trunk (so the apng improvements got dropped as they have been committed a week ago).
This week I rebased the patch series on top of revision 21195 (because 21196 broke the GTK+ build): http://blaubeermuffin.de/builds/2008-08-25-0008/logs/gtk+/#build
And again, updated the patchset.
Updated to today's state of trunk: http://git.imendio.com/?p=projects/gtk%2B.git;a=shortlog;h=refs/heads/apng
Sorry, but any news on this ? By now, it should be clear that: a) there's very little chance that upstream of libpng will accept apng patch b) the patch is sort of useful every now and then, as even when constricted to the same image format limitations, animated pngs still beat animated gifs (at least as far s size goes) c) mng became a road to nowhere Adding a support to gdk-pixbuf would let apng be a citizen of equal rights to gif in gtk world. In the meanwhile, that git from comment 11 seems to have expired. While this would not get much use these days, neither does animated gif. On semi-related note: http://animatedpng.com seems to be down today.
not going to happen inside gdk-pixbuf
In 2003, Gecko stopped rendering MNG images.[1] The most popular current browser left displaying MNG is supposedly Konqueror[2], but even that doesn't work (in Ubuntu at least).[3] Meanwhile, in 2014 Safari joined Firefox in rendering APNG images[4], and in 2015 WebKitGTK+ appears about to follow suit.[5] Of course, Web browsers aren't the be-all and end-all of which image formats are relevant. And I have no opinion on which format is technically superior. It's just unfortunate that we seem to be in a situation where people want to use smooth animated bitmaps in GDK[6], GDK developers defer to libpng, the libpng project continues to endorse MNG but never actually ships it[7], and approximately nobody else is interested in MNG. So Gnome app developers (for example) have to resort to combinations of SVG + JavaScript, or PNG with rotational symmetry + CSS + JavaScript.[8] Someone has to blink. Either (a) MNG suddenly takes off, (b) the libpng project relents and implements APNG, (c) the libpng+apng branch[9] becomes authoritative, or (d) GDK separately implements APNG. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=195280 [2] http://www.libpng.org/pub/mng/mngapbr.html [3] http://libmng.com/MNGsuite/ [4] http://caniuse.com/#feat=apng [5] https://bugs.webkit.org/show_bug.cgi?id=17022#c35 [6] http://launchpad.net/bugs/889889 [7] http://sourceforge.net/p/png-mng/mailman/message/31179009/ [8] https://bugzilla.gnome.org/show_bug.cgi?id=730191 [9] http://sourceforge.net/projects/libpng-apng/
I am interested in implementing APNG support in gdk-pixbuf and EOG as my GSoC 2015 project. I am looking for a Gnome dev, who can become a mentor of my project. As Matthew Paul Thomas showed in his last post, APNG format is on the rise now. WebKit support became possible, when last year Max Stepin figured out how to implement APNG support with a little additional code, using vanilla (without APNG patches) libpng library. I am planning to follow his way and implement APNG support in gdk-pixbuf in a non-intrusive way, with as additional little code as possible. Adding of APNG support to GDK will enable its usage in vast amount of applications, in particular image viewers of Gnome, Mate, XFCE and LXDE desktops. I am looking forward for reply (email) of Gnome devs interested in mentoring my project.
My general opinion hasn't changed: I don't want to add new image loaders for 'minority' formats ('on the rise' or not) in gdk-pixbuf, where we'll be on the hook maintaining that code forever. We have module support for a reason: Just maintain those loaders with the standard image library for the format, as we do for svg. But... I guess this is where apng's problems start to become apparent. An image format without a 'standard' implementation - really ?!
>to add new image loaders for 'minority' formats But the whole thing is not about 'adding a new image loader' -- gdk-pixbuf already has a loader for APNG! (namely `io-png.c` module) The problem is that loaded images are not animated now -- only the first frame is displayed as a still image. It needs to be extended with animation support, with a code similar to that in `io-gif-animation.c`. Take a look at the patch, which introduced animation support in WebKit. WebKit PNG decoder is built on libpng, similarly as that in gdk-pixbuf. https://bugs.webkit.org/attachment.cgi?id=248547&action=diff These are only 607 additional lines of code. It is comparable to 598 lines of code in `io-gif-animation.c`. >An image format without a 'standard' implementation - really ?! GIF does not have a 'standard' implementation as well...
I'll take a look at a patch, certainly. (In reply to Piotr Jurkiewicz from comment #17) <snip> > >An image format without a 'standard' implementation - really ?! > > GIF does not have a 'standard' implementation as well... GIF existed before gdk-pixbuf. I doubt we'd have a JPEG or PNG loader if it didn't have a backing library.
*** Bug 790882 has been marked as a duplicate of this bug. ***
it's almost 2019 now. Google and apple support it. And as it was pointed out above, it's not an additional format, it's already half supported by showing the first frame.
(In reply to dfhyuilkiolioup from comment #20) > it's almost 2019 now. Google and apple support it. And as it was pointed out > above, it's not an additional format, it's already half supported by showing > the first frame. Google and Apple use this format for their web browsers. GdkPixbuf is not used by web browsers, nor it should be, as GdkPixbuf is not heavily secured. GdkPixbuf is, these days, mostly meant to load assets like icons and small images shipped by applications and, at most, for generating static thumbnails. If you want to load user provided images, I strongly encourage you to use Gegl instead: https://gitlab.gnome.org/GNOME/gegl As an image loading library, it's far more efficient than GdkPixbuf. Nevertheless, if you still want to create an APNG GdkPixbuf loader you can still do it out of tree, like the SVG loader is part of librsvg.
...There's isn't some conflict here? You already have png, but apng is recognized as png?