APNG


The Animated Portable Network Graphics file format is an extension to the Portable Network Graphics specification. It allows for animated PNG files that work similarly to animated GIF files, while supporting 24-bit images and 8-bit transparency not available for GIFs. It also retains backward compatibility with non-animated PNG files.
The first frame of an APNG file is stored as a normal PNG stream, so most standard PNG decoders are able to display the first frame of an APNG file. The frame speed data and extra animation frames are stored in extra chunks. APNG competes with Multiple-image Network Graphics, a comprehensive format for bitmapped animations created by the same team as PNG. APNG's advantage is the smaller library size and compatibility with older PNG implementations.
In a comparison made between GIF, APNG and WebP, it was shown that APNG kept lower file size while keeping at least equal quality.

History

The APNG specification was created in 2004 by Stuart Parmenter and Vladimir Vukićević of the Mozilla Corporation to allow for storing the animations needed for interfaces such as throbbers. In May 2003, Mozilla had scrapped support for MNG animations, which provides a superset of APNG functionality, citing concerns about the large file size required for the expansive MNG decoder library ; the APNG decoder, built on the back of the PNG decoder, was a much smaller component.
Among users and maintainers of the PNG and MNG formats, APNG had a lukewarm reception. In particular, PNG was conceived to be a single-image format. APNG hides the subsequent frames in PNG ancillary chunks in such a way that APNG-unaware applications would ignore them, but there are otherwise no changes to the format to allow software to distinguish between animated and non-animated images. Some of the main concerns arising from this were the inability of applications to negotiate for PNG and APNG, or distinguish between PNG and APNG once received, or for legacy software to even inform users that there are additional frames. Glenn Randers-Pehrson spearheaded efforts to reconcile the PNG purists' position with that of APNG proponents by recommending changes to APNG's format and proposing the use of a unique MIME type, but the APNG proponents only added the different MIME type while insisting on the use of the .png extension instead of .apng, leading to the format not being approved by the PNG Development Group.
The PNG group officially rejected APNG as an official extension on April 20, 2007. There have been several subsequent proposals for a simple animated graphics format based on PNG using several different approaches.
Mozilla Firefox added support for APNG in version 3 trunk builds on March 23, 2007. However, because libpng is the PNG Group's reference implementation of the official specification, APNG support can never be supported in the main libpng distribution so long as it remains unratified by the Group. Iceweasel 3 supports APNG by using Mozilla's unofficial variant of libpng.
to create APNG Images.
In 2008 WorldDMB adopted APNG as a backward compatible extension to enable animation as part of the MOT SlideShow user application for Digital Radio. "APNG 1.0 Specification - Animated Portable Network Graphics" is included as normative Annex A in the ETSI standard TS 101 499 V2.2.1. In 2010 Commercial Radio Broadcasters in Sydney began to include APNG animations in DAB+ digital radio broadcasts. These APNG animations are carried by the "MOT slideshow" application which accompanies the audio services. It is expected that other cities in Australia will follow in early 2011.
Mozilla's role in extending the PNG format to APNG echoes Netscape's much earlier role in popularizing animated GIFs.
In 2016, Apple adopted the APNG format as the preferred format for animated stickers in iOS 10 iMessage apps.
On March 15, 2017 APNG support was added to Chromium.

Support

A server-side library exists that allows web browsers that support the canvas tag, but do not support APNG, to display APNGs. Examples of such browsers include Microsoft Edge and Internet Explorer 9.

File format

The follows the PNG File format introducing three new ancillary chunks:
Sequence numbers apply to both frame control and frame data chunks, which together follow a common sequence, thus enabling the order and timing of frames to be recovered should an APNG-unaware PNG editor re-order them as allowed by PNG chunk ordering rules.
Frames utilize the same bit depth, color type, compression method, filter method, interlace method, and palette as the default image.
The was designed with future extensions in mind. An application reading a PNG file is supposed to simply ignore any chunks which it does not understand. This is the reason why APNG is backwards compatible. Existing applications just recognize the first frame and ignore the additional animation chunks.

Process

A program wanting to assemble several individual PNG files to an animated PNG could proceed as follows:
  1. Take all chunks of the first PNG file as a building basis.
  2. Insert an animation control chunk after the image header chunk.
  3. If the first PNG is to be part of the animation, insert a frame control chunk before the image data chunk.
  4. For each of the remaining frames, add a frame control chunk and a frame data chunk. Then add the image end chunk. The content for the frame data chunks is taken from the image data chunks of their respective source images.
The next diagram illustrates this process.

Advantages

APNG has some specific advantages, in addition to expanded depth and transparency :
APNG has shortcomings:

Raster formats

The MNG file format is a more powerful alternative to APNG, although it's a more complex format. It also has less web browser support. Mozilla and Netscape browsers removed the MNG support in 2003, and MNG support was never included in Google Chrome, Internet Explorer, Opera, or Safari.
The GIF file format has better application and browser support than APNG, but it is limited to 256 colors per frame and supports only index transparency, by mapping one of the palette colors to transparent.
WebM, a video format, has been adopted by some sites such as 4chan as an alternative to other animated formats, including APNG. WebM VP9 supports both lossy and lossless compression.
Google WebP also supports true color with alpha channel animation.

Vector formats

combined with scripting or SMIL can animate vector graphics and can incorporate raster graphics.

Scripting and other methods

Dynamic graphics created with the HTML 5 canvas object can also be animated. The APNG addon for Google Chrome uses this technique to display APNG images.
CSS Animations is a proposed module for Cascading Style Sheets that allows for the animation of XML elements using CSS.
An alternative method for animations in web pages is to use conventional static images and animate them using JavaScript or plugin based technologies like Adobe Flash, Microsoft Silverlight and Java.