APNG
Animated Portable Network Graphics (APNG) is a file format which extends the Portable Network Graphics (PNG) specification to permit animated images 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.
An animated PNG or APNG (displays as static image in some web browsers) | |
Filename extension |
.png .apng |
---|---|
Initial release | August 4, 2008 |
Type of format | animated raster image format |
Extended from | PNG |
Open format? | yes |
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.
In a comparison made between GIF, APNG and WebP, it was shown that APNG kept lower file size while keeping at least equal quality.[1]
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 (300 KB);[2] 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.[3] 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 (e.g., video/png), but the APNG proponents only added the different MIME type (image/apng)[4] while insisting on the use of the .png extension instead of .apng, leading to the format not being approved by the PNG Development Group.[5]
The PNG group officially rejected APNG as an official extension on April 20, 2007.[6] There have been several subsequent proposals for a simple animated graphics format based on PNG using several different approaches.[7]
Mozilla Firefox added support for APNG in version 3 trunk builds on March 23, 2007.[8] 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.[9]
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.[10] 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.[11]
File format
The APNG specification follows the PNG File format introducing three new ancillary chunks:
- The animation control chunk (acTL) precedes the IDAT(s) of the default image and is a kind of "marker" that this is an animated PNG file. It also contains the number of frames and the number of times to loop the animation (0 meaning infinite).
- The frame control chunk (fcTL) precedes each frame and contains its metadata : dimensions ; position (relative to the default image) ; if once over it is cleared to black, replaced by the previous frame or drawn over by the next frame ; and if its transparency applies.
- The frame data chunk (fdAT) storing frame's content. It starts with a sequence number, then has the same structure as the default image's IDAT chunk(s).
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[13] should an APNG-unaware PNG editor re-order them as allowed by PNG chunk ordering rules.[14]
Frames utilize the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the default image.
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.
Process
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). Then add 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.
Advantages and disadvantages
APNG has some specific advantages, in addition to expanded depth and transparency :
- Backward compatibility with non-animated PNG.
- Simple to decode.
- The default image can be left out of the animation and thus serve as a "poster" if non-animated.
- Better compression in most cases.
APNG has shortcomings:
- Externally looking like a PNG generates confusion for users and tools, unlike GIF which is also just an image format that look like normal image, APNG is not widely known for animated images.
- No global time concept. Time-seeking or getting the total duration requires scanning all frame control chunks first.
- No frame reuse (except for restoring the previous one). Recurring frames or reverse sequences (like a bouncing ball) have to duplicate existing frames.
- No sharing of common raster data. Instead the current rendering can be incorporated by transparency (at the cost of storing transparency for all frames) or not covering the whole canvas (at the cost of possibly decomposing the frame in several simultaneous, making edition harder), except the first frame can't.
- All frames are in the same format; sharing bit depth, color type, compression method, filter method, interlace method, palette (if any), and transparency type.
- Each frame totals at least 24 bytes of chunk overhead. This can waste significant space for small animations.
- A "poster" (as above) is effectively hidden by the standard auto-play behavior, potentially concealing undesirable content.
Support
Field | Software | Supports? | Since |
---|---|---|---|
Image processing |
APNG Assembler | Yes | v. 1[15] |
cphktool APNG Anime Maker | Yes | v. 1 (9 June 2009)[16] | |
APNG Disassembler | Yes | v. 1 [17] | |
APNG Optimizer | Yes | v. 1.0 (28 March 2011)[18] | |
FFmpeg | Yes[19] | v. 2.7[20] | |
Gamani GIF Movie Gear | Yes | v. 4.2 (March 2008)[21] | |
GIMP | Needs plug-in[22] | N/A | |
ImageJ | Yes | v. 1.41g (3 July 2008)[23] | |
Imagine | Yes | v. 1.0.2 (4 May 2008)[24] | |
IrfanView | Read-only | v. 4.40 (31 July 2015) | |
Konvertor | Yes | v. 4.02 (May 2010)[25] | |
KSquirrel (later SAIL) | Read-only | v. 0.7.2 (3 October 2007)[26] | |
Paint.NET | Needs plugin[27] | N/A | |
RealWorld Paint | Yes | v. 2011.1 (December 2011)[28] | |
VirtualDub | Needs plugin[29][lower-alpha 1] | N/A | |
XnView | Read-only | v. 1.97.4 (30 April 2010)[30] | |
Sciter and HTMLayout UI engines | Read-only | since 2008 | |
Krita | No[31] | N/A | |
Browser Engines |
WebKit | Yes | (17 March 2015)[32] |
Blink | Yes | June 2017 | |
Web browsers |
Mozilla Firefox (Gecko layout engine) |
Yes | v. 3 (17 June 2008)[33][34] |
SeaMonkey (Gecko layout engine) |
Yes | v. 2 | |
Iceweasel and other Debian rebrandings (Gecko layout engine) |
Yes | v. 4.0~b12[9] | |
Safari (WebKit layout engine) |
Yes | v. 8.0[35] | |
Google Chrome and Chromium (Blink layout engine) |
Yes | v. 59 (5 June 2017)[36][37] | |
Internet Explorer (Trident layout engine) |
No[35] | N/A | |
Microsoft Edge (EdgeHTML layout engine) |
No[35][38] | N/A | |
Microsoft Edge (Blink layout engine) |
Yes | v. 79 | |
Opera v12 and earlier (Presto layout engine) |
Yes | v. 9.5 (12 June 2008)[39] | |
Opera 15 and later (Blink layout engine) |
Yes | v. 46.0 (22 June 2017)[40] | |
Pale Moon (Goanna layout engine) | Yes | v. 27 | |
Mobile browsers |
iOS Safari | Yes[35] | v. 8.0 |
Firefox for Android | Yes[35] | ? | |
Samsung Internet for Android | Yes | v. 7.0 | |
Opera Mobile | Yes | ? |
- After loading a video, an APNG file can be created via the "File|Export|Animated PNG" menu item.
A server-side library exists that allows web browsers that support the canvas tag, but do not support APNG, to display APNGs.[41] Examples of such browsers include Microsoft Edge and Internet Explorer 9.
Alternatives
- 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,[42] 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
- SVG combined with scripting or SMIL can animate vector graphics and can incorporate raster graphics. (See SVG animation.)
- 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[43] or plugin based technologies like Adobe Flash, Microsoft Silverlight and Java.
References
- "GIF vs APNG vs WebP". littlesvr. Retrieved 2019-04-02.
- 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.
- "APNG Specification, Version 1.0#MIME type". Mozilla. Retrieved 2017-12-10.
- "ImageMagick can't detect animated PNG". Retrieved 2017-12-10.
- "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 December 26, 2009. 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" (PDF). ETSI. Retrieved 30 January 2013.
- Inc., Apple. "Messaging - Extensions - iOS Human Interface Guidelines". developer.apple.com. Retrieved 2016-10-12.
- "Anzwix / Chromium / Add support for Animated PNG". Retrieved 2017-03-15.
- Chunk Sequence Numbers (APNG spec)
- Chunk Ordering Rules (PNG 1.2 spec)
- maxst. "APNG Assembler". SourceForge.
- "cphktool APNG Anime Maker". cphktool. Retrieved 2010-06-28.
- maxst. "APNG Disassembler". SourceForge.
- maxst. "APNG Optimizer". SourceForge.
- https://www.ffmpeg.org/ffmpeg-formats.html#apng
- "GitHub changelog of FFmpeg". Retrieved 2016-07-09.
- "Animated PNG: Simple Animation with an Alpha Channel". Gamani. Retrieved 2009-08-25.
- "APNG Plug-In". Archived from the original on 2014-05-25. Retrieved 2010-05-28.
- "ImageJ News". ImageJ. Archived from the original on May 21, 2009. Retrieved 2009-05-23.
- "Imagine - What's new". Archived from the original on October 8, 2011. Retrieved 2017-09-01.
- "Konvertor - Solutions for Multimedia Processing". Archived from the original on 2010-05-12. Retrieved 2010-05-19.
- "KSquirrel Codecs ChangeLog".
- "Animated Image 2.4 - AGIF & APNG". Paint.NET Forum.
- "APNG support announcement".
- "SourceForge.net: VirtualDub APNG Mod".
- While XnView is available for several operating systems, only versions for Windows have been released since APNG support was added.
- "APNG export support". Retrieved 2018-09-18.
- "Animated PNG graphics". WebKit. Mar 17, 2015. Retrieved 2015-03-17.
- Parmenter, Stuart; Vladimir Vukicevic; Andrew Smith (July 4, 2008). "Animated PNG graphics". Mozilla Developer Center. Mozilla. Retrieved 2009-05-23.
- "Firefox 3 for developers". Mozilla Developer Center. Mozilla. October 1, 2008. Archived from the original on 2008-11-13. Retrieved 2009-05-23.
- "Animated PNG (APNG)". Can I use... Support tables for HTML5, CSS3, etc.
- "Add support for Animated PNG".
- "Stable Channel Update for Desktop". Chrome Releases. Retrieved 2017-06-06.
- "The status of APNG image format in Microsoft Edge". Microsoft Edge Development. Retrieved 2017-07-29.
- "Web specifications supported in Opera 9.5". Opera Software. Archived from the original on 2009-02-25. Retrieved 2009-05-23.
- "Opera 46 goes final, more quality and Opera's first TV ad". Opera Software. Retrieved 2017-06-26.
- "APNG-canvas Library".
- Bug 195280 – Removal of MNG/JNG support
- "AniPNG Demonstration". 2008-12-08.
External links
Wikimedia Commons has media related to Animated PNG. |
- The APNG specification at mozilla.org's Wiki
- APNG patch for libpng
- 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
- Online tools for creating, editing and converting APNG
- APNG viewer utility for iOS
- AJAX loading animations in APNG
- Opera extension for APNG creation from screenshots
- apngasm - FOSS Animated PNG tools and APNG standardization
- Animizer.net - Web application for creating and editing APNG
- Trying to add APNG support in native level of Chromium (also Android support)
- APNG consideration in the Chromium development group