After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 151281 - add support for APNG (animated PNG) format
add support for APNG (animated PNG) format
Status: RESOLVED WONTFIX
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
: 790882 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-08-28 10:45 UTC by Christian Persch
Modified: 2018-12-01 18:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Persch 2004-08-28 10:45:37 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 .
Comment 1 Matthias Clasen 2004-08-28 15:22:47 UTC
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?
Comment 2 Matthias Clasen 2004-08-28 16:21:55 UTC
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.
Comment 3 Andrew Sobala 2004-08-28 18:38:08 UTC
Thierry: Please do *not* attempt to triage GTK+ bugs.
Comment 4 Andrew Smith 2007-07-03 16:46:20 UTC
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.
Comment 5 Matthias Clasen 2007-07-03 16:53:36 UTC
Get the libpng patch upstream.
Comment 6 Sven Herzberg 2008-07-29 16:37:35 UTC
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
Comment 7 Sven Herzberg 2008-08-09 11:47:24 UTC
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.
Comment 8 Sven Herzberg 2008-08-15 12:15:22 UTC
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).
Comment 9 Sven Herzberg 2008-08-27 06:57:05 UTC
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
Comment 10 Sven Herzberg 2008-09-09 06:29:14 UTC
And again, updated the patchset.
Comment 11 Sven Herzberg 2008-12-05 13:16:10 UTC
Updated to today's state of trunk:

http://git.imendio.com/?p=projects/gtk%2B.git;a=shortlog;h=refs/heads/apng
Comment 12 Rafał Mużyło 2011-09-16 17:30:58 UTC
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.
Comment 13 Matthias Clasen 2013-12-19 11:30:19 UTC
not going to happen inside gdk-pixbuf
Comment 14 Matthew Paul Thomas (mpt) 2015-03-09 16:27:58 UTC
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/
Comment 15 Piotr Jurkiewicz 2015-03-18 05:00:50 UTC
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.
Comment 16 Matthias Clasen 2015-03-25 12:05:54 UTC
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 ?!
Comment 17 Piotr Jurkiewicz 2015-03-25 18:28:07 UTC
>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...
Comment 18 Bastien Nocera 2015-03-25 18:32:13 UTC
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.
Comment 19 Piotr Drąg 2017-11-27 01:28:51 UTC
*** Bug 790882 has been marked as a duplicate of this bug. ***
Comment 20 dfhyuilkiolioup 2018-12-01 17:26:40 UTC
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.
Comment 21 Emmanuele Bassi (:ebassi) 2018-12-01 17:59:51 UTC
(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.
Comment 22 dfhyuilkiolioup 2018-12-01 18:51:26 UTC
...There's isn't some conflict here?
You already have png, but apng is recognized as png?