|This article relies on references to primary sources. (January 2013)|
|Initial release||August 4, 2008|
|Type of format||animated raster image format|
The Animated Portable Network Graphics (APNG) file format is a non-standard extension to the Portable Network Graphics (PNG) 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 (as provided for by the original PNG specification).
APNG competes with Multiple-image Network Graphics (MNG), 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.
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. Mozilla had scrapped in May 2003 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 (300 KB); 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 was not well received. 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. In effect this was a repeat of some of the same mistakes made in the GIF format 10 years earlier. 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 (e.g. video/png), but Mozilla rejected these proposals in favour of full backward compatibility.
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 now supports APNG by using Mozilla's unofficial variant of libpng.
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.
Application support 
||This section's use of external links may not follow Wikipedia's policies or guidelines. (February 2013)|
|Adobe Photoshop (Only command-line interface for creates animation from image sequence)||with the apngasm Plugin|
|cphktool APNG Anime Maker||v. 1 (June 9, 2009)|
|Gamani GIF Movie Gear||v. 4.2 (March 2008)|
|GIMP||with the APNG Plug-in.|
|ImageJ||v. 1.41g (July 3, 2008)|
|Imagine||v. 1.0.4 (November 14, 2008)|
|Konvertor||v. 4.02 (May 2010)|
|KSquirrel||v. 0.7.2 (October 3, 2007)|
|Paint.NET||with the animation plugin|
|RealWorld Paint||v. 2011.1 (December 2011)|
|VirtualDub||with VirtualDub APNG Mod|
|XnView||read-only, v. 1.97.4 (April 30, 2010)|
|Web browsers||Gecko-based||Mozilla Firefox||v. 3 (June 17, 2008)|
|Iceweasel and other rebranded Mozilla products by the Debian project||v. 4.0~b12|
|Opera||v. 9.5 (June 12, 2008)|
|Google Chrome/Chromium||with APNG addon|
||iOS||with 3rd party library.|
|Android||with Firefox for Android|
|Internet Explorer Mobile||No|
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 Google Chrome, Internet Explorer 9, and Apple Safari.
Technical details 
A PNG file consists of the PNG Signature (8 special bytes), followed by a series of chunks. A chunk consists of four parts: Length (4 bytes), Chunk type (4 bytes), Chunk data (length bytes) and CRC (Cyclic Redundancy Code / Checksum, 4 bytes).
The next graphic shows the contents of such a minimal PNG file, representing just one red pixel. The PNG signature bytes and the individual chunks are marked with colors. On the left side, the byte values are shown in hex format, on the right side as their equivalent characters from ISO-8859-1 with unrecognized and control characters replaced with periods. This dual display is common for hex editors. Note that the chunks are easy to identify because of their human readable 4-byte type names (in this example IHDR, IDAT & IEND).
The APNG specification introduces three new chunks: The animation control chunk (acTL), the frame control chunk (fcTL) and the frame data chunk (fdAT). The animation control chunk is a kind of "marker" chunk, telling the parser that this is an animated png. It contains information about how many frames the animation consists of and how many times the animation should play before coming to rest. The frame control chunk contains several bits of information, the most important of which is the display time of the following frame. The frame data chunks have the same structure as the IDAT chunks, except preceded by a sequence number. 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.
A program wanting to assemble several individual PNG files to an animated PNG could proceed as follows:
- Take all chunks of the first PNG file as a building basis.
- Insert an animation control chunk (acTL) after the image header chunk (IHDR).
- If the first PNG is to be part of the animation, insert a frame control chunk (fcTL) before the image data chunk (IDAT).
- For each of the remaining frames, add a frame control chunk (fcTL) and a frame data chunk (fdAT) before the image end chunk (IEND). The content for the frame data chunks (fdAT) is taken from the image data chunks (IDAT) of their respective source images.
The next diagram illustrates this process.
The PNG specification 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.
Raster formats 
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.
Vector formats 
Scripting and other methods 
- martin (1999-11-11). "Bug 18574 - (mng) restore support for MNG animation format and JNG image format". Mozilla. Retrieved 2010-03-30.
- "PNG (Portable Network Graphics) Specification, Version 1.1#8.4. Multiple-image extension". libpng. Retrieved 2010-03-30.
- "VOTE FAILED: APNG 20070405a". SourceForge mailing list. 2007-04-20.
- "Discussion for a simple "animated" PNG format". Archived from the original on 2009-02-26. Retrieved 2011-07-12.
- "Gran Paradiso Alpha 3 release notes". Mozilla. 2007-03-23. Archived from the original on 9 May 2010. Retrieved 2010-03-30.
- "Debian Bug #486827 Iceweasel cannot render APNG image". Debian. 2011-08-26. Retrieved 2011-09-18.
- "Digital Audio Broadcasting (DAB); MOT SlideShow; User Application (pdf) Specification". ETSI. Retrieved 30 January 2013.
- "cphktool APNG Anime Maker". cphktool. Retrieved 2010-06-28.
- "Animated PNG: Simple Animation with an Alpha Channel". Gamani. Retrieved 2009-08-25.
- "ImageJ News". ImageJ. Archived from the original on 21 May 2009. Retrieved 2009-05-23.
- "Imagine - What's new". Retrieved 2009-08-25.[dead link]
- "Konvertor - Solutions for Multimedia Processing".
- "ksquirrel Changelog Sektion: ksquirrel-0.7.2". SourceForge. Retrieved 2009-05-23.
- "APNG support announcement".
- After loading a video, an APNG file can be created via the "File|Export|Animated PNG" menu item.
- While XnView is available for several operating systems, only versions for Windows have been released since APNG support was added.
- Parmenter, Stuart; Vladimir Vukicevic, Andrew Smith (4 Jul 2008). "Animated PNG graphics". Mozilla Developer Center. Mozilla. Retrieved 2009-05-23.
- "Firefox 3 for developers". Mozilla Developer Center. Mozilla. 1 Oct 2008. Retrieved 2009-05-23.
- "Web specifications supported in Opera 9.5". Opera Software. Retrieved 2009-05-23.
- "APNG not animating in Internet Explorer 9 - Microsoft Community". Microsoft. Retrieved 2011-05-10.
- "Issue 1171 - Request for enhancement: APNG (animated PNG)".
- "APNG-canvas Library".
- Chunk Sequence Numbers (APNG spec)
- Chunk Ordering Rules (PNG 1.2 spec)
- "AniPNG Demonstration". 2008-12-08.
|Wikimedia Commons has media related to: Animated PNG|
- The APNG specification at mozilla.org’s Wiki
- Mozilla's APNG Demo Site
- Directory of APNG Software and Developers resources
- APNG tests for browsers supporting APNG 1.0
- APNG assembler: online PNG ➔ APNG converter
- APNGs.com, an online APNG creation tool with an APNG gallery
- APNG extension for Google Chrome
- APNG viewer utility for iOS
- AJAX loading animations in APNG
- Opera extension for APNG creation from screenshots