37 comments

[ 3.3 ms ] story [ 59.5 ms ] thread
Status: RESOLVED FIXED

It's implemented on top of vanilla libpng.

In practice, only WebKit-based browsers will get APNG, not Chromium-based ones. That's not a big market share. But WebKit and Blink engines are still pretty similar, so there's something to consider.

Vanilla libpng, not libapng? Interesting. Apparently they've built an APNG decoder.
> In practice, only WebKit-based browsers will get APNG, not Chromium-based ones. That's not a big market share.

Safari Mobile is a pretty big marketshare, if that ever trickles down to it.

Safari uses WebKit, except for WebKit image decoders.

The good news is, Apple implemented APNG support on their own: http://caniuse.com/apng

So at this point there are 2 open source implementation, plus 1 closed source.

Two down (Gecko, WebKit), two to go (Trident, Blink).

I'd love to see more browsers have APNG. Alpha transparency in animation is awesome.

It's not a lossy format like WebP, but PNG offers more sophisticated lossless compression than GIF (after all, it was supposed to be a better GIF, basically), so I wonder if APNG could produce more efficient compression for video with a good encoder.

> so I wonder if APNG could produce more efficient compression for video with a good encoder.

It's hard to not be more efficient than GIF.

True, but GIF is only super-inefficient because it's used for video despite not being designed for it, I think.
That's one problem, and APNG won't solve it, because both use lossless compression not ideal for videos.

Apart from that, GIF is almost 30 years old. Compression standards improved a lot since.

Oh, of course APNG won't solve it for the same reason. But it could still offer (perhaps marginally) better compression.
The big difference is that GIF uses LZW compression which is less efficient than DEFLATE (i.e. ZLIB) which is used in PNG.
> It's not a lossy format like WebP

WebP can hold both lossless and lossy animations. AFAIK it can even have mixed lossless and lossy frames in the same animation.

Oh yes, I'm aware that it also supports lossless. I mentioned lossy because that's what matters for the case of video specifically.
I can't wait for APNG support to become standard. Most of the GIF animations on Wikimedia Commons seem like they'd be more efficiently encoded as PNGs; I wonder what the size comparison (GIF vs. APNG) is like for some of the images on there? e.g.

http://commons.wikimedia.org/wiki/File:Color_coded_racetrack...

Many would be even more efficiently encoded in <choose your favorite video format here>, I guess.
Would've been great to see this happen five years, seems like it's largely irrelevant now with the prevalence of HTML5 video compression for short clips.
For photorealistic video yes, but APNG is much more suited than anything else for animated graphics where SVG isn't a good fit.
Do you have examples where APNG wins compression-wise relative to H.264?
JPEG usually wins over PNG compression-wise, but in some use cases it makes sense to use PNG.

The same thing with animation/video.

Suited in terms of desired quality, not necessarily file size. Sometimes you need pixel perfect frames, not 4:2:2 b-frame messiness.
If nothing else, this lets you make loading spinners with proper alpha-blended antialiased edges (so you don't need "dark background" and "light background" versions).
Indeed, as far as I know, most video formats currently playable in browsers don't support transparency at all.
Hardly. Mobile Safari just added APNG, and web video is still not going to be as convenient as images for some time to come.
Or something similar to this - http://gfycat.com/SomeUnkemptKrill

Slight quality loss admittedly, but a huge bandwidth saving and I believe supported across all browsers now.

I'll admit however I didn't think about some other advantages of PNG (transparency for one), which would mean it was more suitable in some situations.

Well at least on iOS the video requires a tap to play and then promptly goes fullscreen (requiring another two taps to dismiss)
Oh goodness. With retina displays becoming commonplace, the need for a modernized lossy + alpha standard like JPEG2000, JPEG XR or even WebP is stronger than ever. I can't believe they're wasting resources on… better meme cartoons…
APNG is a funny, political beast. It basically evolved after Mozilla decided to nuke MNG support to make Firefox slimmer and then needed to re-invent a transparency-capable animation format for browser "throbbers". There were calls to replace libpng with libmng which purported to support both PNG and MNG at the same binary size, but those never panned out.

IIRC, individuals in the PNG group took the whole thing as a slight and then refused to incorporate it into the official spec, leaving it as a bit of an orphan. The Chrome guys never bothered implementing it and quietly worked on WebP.

I suspect that part of the reason APNG never received widespread adoption was bad blood from MNG never getting proper attention. While MNG was kind of a crappy spec in retrospect, it was still way better than an animated GIF.

Unfortunately JNG was also a casualty in this whole war -- a format that could have been both lossless and supported proper alpha transparency.

https://bugzilla.mozilla.org/show_bug.cgi?id=195280

https://bugzilla.mozilla.org/show_bug.cgi?id=18574

As far as I remember, the main difference in point of view was that the PNG guys (rightly so, IMO) saw animations as something different from a still image, and wanted to keep that distinction, also in the face of MIME types, file headers, file name extensions, etc., while lots of other (misguided) people wanted animation as a feature in an image format, because they were used to that from GIF.

There may have been some bad blood from MNG, but that was not the main point as far as I understand. Although I must say that the links you provide are interesting reading.

Here's the vote where the PNG group rejected APNG:

https://web.archive.org/web/20080203042347/http://sourceforg...

And Vlad's message after the vote:

http://osdir.com/ml/graphics.png.general/2007-04/msg00286.ht...

APNG support in WebKit is implemented as a thin layer on top on regular vanilla libpng.

So all that stuff is not very relevant.

From a technical point of view it's all irrelevant, but I find APNG to be very interesting from a historical point of view. It's both a technical and a political compromise, and all things considered, not a bad standard.
Animated GIF's can be lossless optimized with GIFsicle. I went looking for something similar for APNG and found apngopt.

http://sourceforge.net/projects/apng/files/APNG_Optimizer/

Think of it as pngcrush for each animation frame. Also, it can leverage Google's Zopfli implementation of DEFLATE, which produces much smaller output than zlib's implementation. I haven't seen any other lossless optimization tools using Zopfli, so that's pretty cool. (update: actually it looks like recent versions of advpng can use Zopfli)

Also, some good comparisons of APNG vs. GIF vs. WebP animations are here:

http://littlesvr.ca/apng/gif_apng_webp1.html

As APNG any good? My uninformed impression is it's kind of crap. Wishing they'd all support BPG instead

http://bellard.org/bpg/

Unfortunately, BPG is heavily patent encumbered so no one can risk shipping it right now.