APNG

From Vero - Wikipedia
Jump to navigation Jump to search

Template:Short description {{#invoke:other uses|otheruses}} Template:Infobox file format

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 images with a higher color depth and full alpha 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 all of the subsequent frames are stored in extra chunks (as provided for by the original PNG specification). APNG competed with Multiple-image Network Graphics (MNG), a comprehensive format for bitmapped animations which was created by the same team as PNG and is obsolete. APNG's advantages over MNG are its smaller library size and its compatibility with older PNG implementations.

History and development

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.<ref name="bugzilla"/><ref>Template:Cite web</ref> 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);<ref>Template:Cite web</ref> 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.<ref>Template:Cite web</ref> 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)<ref>Template:Cite web</ref> while insisting on the use of the .png extension instead of .apng, leading to the format not being approved by the PNG Development Group.<ref>Template:Cite web</ref>

The PNG Development Group rejected APNG as an official extension on April 20, 2007,<ref>Template:Cite web</ref> and there have been several subsequent proposals for a simple animated graphics format based on PNG using several different approaches.<ref name="proposalcomparison">Template:Cite web</ref> However, since September 14, 2021, the PNG Working Group has been chartered by the World Wide Web Consortium (W3C) to maintain and develop for the PNG specification, and the first public working draft of PNG Specification (Third Edition) was published on October 25, 2022, adding APNG extensions to the core PNG specification.<ref>Template:Cite web</ref> The Candidate Recommendation was published on September 21, 2023.<ref>Template:Cite web</ref>

On June 24, 2025 it was finally elevated to the Recommendation final status by the W3C.

File format

The APNG specification follows the PNG File format introducing three new ancillary chunks:<ref name="spec">Template:Cite web</ref>

  • 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); duration; 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 should an APNG-unaware PNG editor re-order them as allowed by PNG chunk ordering rules.<ref name="PNG chunk">Chunk Ordering Rules (PNG 1.2 spec)</ref>

Frames utilize the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the default image.

An application reading a PNG file is meant to ignore any chunks which it does not understand,<ref name="pngspec">Template:Cite web</ref> making APNG backwards compatible. Applications without support for the APNG extension show only the first frame, disregarding the rest of the frames.

File:Apng assembling.svg
Diagram illustrating a possible way to assemble an animated PNG from three individual PNG files

Compression and optimization

A number of optimization techniques make APNG files as small as possible: Inter-frame optimization <ref>Template:Cite web</ref> utilizing alpha-blend and alpha dispose operations, smaller than the full-size subframes, dirty transparency, color type and color palette optimizations, and various compression options: zlib, 7-Zip, Zopfli.<ref>Template:Cite web</ref>

Derived formats

Animated stickers for Signal are APNG with some restrictions (the size of the file is limited to 300kb, the length of the animation is limited to 3 seconds and, visibly (this last point is unclear), the resolution must be 512x512px).Template:Which<ref name="Signal">Template:Cite web</ref>

Support

Template:See also

File:APNG Assembler Logo.svg
The logo of APNG Assembler, free software to create APNG images

Mozilla Firefox added support for APNG in version 3 trunk builds on March 23, 2007.<ref>Template:Cite web</ref> However, because libpng is the PNG Group's reference implementation of the official specification, APNG support was not added prior to version 1.8 of the main libpng distribution since it was unratified by the Group before. Iceweasel 3 supports APNG by using Mozilla's unofficial variant of libpng.<ref name="Debian">Template:Cite web</ref>

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.<ref>Template:Cite web</ref> In 2016, Apple adopted the APNG format as the preferred format for animated stickers in iOS 10 iMessage apps.<ref>Template:Cite web</ref> On March 15, 2017, APNG support was added to Chromium.<ref>Template:Cite web</ref>

List of computer programs and their support of APNG, along with their version numbers and release date
Field Software Supports? Since
Image
processing
APNG Assembler Template:Yes v. 2.91<ref>Template:Cite web</ref>
cphktool APNG Anime Maker Template:Yes v. 1 (9 June 2009)<ref>Template:Cite web</ref>
APNG Disassembler Template:Yes v. 1 <ref>Template:Cite web</ref>
APNG Optimizer Template:Yes v. 1.0 (28 March 2011)<ref>Template:Cite web</ref>
Chasys Draw IES Template:Yes<ref>Template:Cite web</ref> v. 5.17.05<ref>Template:Cite web</ref>
Clip Studio Paint Template:Yes v. 1.6.7 (7 September 2017)<ref>Template:Cite web</ref>
FFmpeg Template:Yes<ref>Template:Cite web</ref> v. 2.7<ref>Template:Cite web</ref>
Template:Interlanguage link Template:Yes v. 2.3.13<ref>Template:Cite web</ref>
Gamani GIF Movie Gear Template:Yes v. 4.2 (March 2008)<ref>Template:Cite web</ref>
GID Template:Partial v. 11 (December 2023)<ref>Template:Cite web</ref>
GIMP Template:Yes<ref>Template:Cite web</ref> Planned
Honeycam Template:Yes v. 3.48 (29 November 2021)<ref>Template:Cite web</ref>
Honeyview Template:Yes v. 5.10 (17 February 2015)<ref>Template:Cite web</ref>
ImageJ Template:Yes v. 1.41g (3 July 2008)<ref>Template:Cite web</ref>
ImageMagick Template:Yes v. 7.0.10-31 (20 September 2020)<ref>Template:Cite web</ref>
Imagine Template:Yes v. 1.0.2 (4 May 2008)<ref>Template:Cite web</ref>
IrfanView Template:Partial v. 4.40 (31 July 2015)
Konvertor Template:Yes v. 4.02 (May 2010)<ref>Template:Cite web</ref>
KSquirrel (later SAIL) Template:Partial v. 0.7.2 (3 October 2007)<ref>Template:Cite web</ref>
Paint.NET Template:Needs<ref>Template:Cite web</ref> Template:N/A
PhotoLine Template:Yes v19.5 (11 March 2016)
RealWorld Paint Template:Yes v. 2011.1 (December 2011)<ref>Template:Cite web</ref>
VirtualDub Template:Needs<ref>Template:Cite web</ref>Template:Efn Template:N/A
XnView Template:Partial v. 1.97.4 (30 April 2010)<ref>While XnView is available for several operating systems, only versions for Windows have been released since APNG support was added.</ref>
Sciter and HTMLayout UI engines Template:Partial since 2008
Krita Template:Yes<ref>Template:Cite web</ref> Krita Nightly 5.0.0 pre-alpha (since 22 February 2021)<ref>Template:Cite web</ref>
qView Template:Partial v. 4.0 (31 October 2020)
Browser
engines
WebKit Template:Yes (17 March 2015)<ref>Template:Cite web</ref>
Blink Template:Yes June 2017
Web
browsers
Mozilla Firefox
(Gecko layout engine)
Template:Yes v. 3 (17 June 2008)<ref>Template:Cite web</ref><ref>Template:Cite web</ref>
SeaMonkey
(Gecko layout engine)
Template:Yes v. 2
Iceweasel and other Debian rebrandings
(Gecko layout engine)
Template:Yes v. 4.0~b12<ref name="Debian" />
Safari
(WebKit layout engine)
Template:Yes v. 8.0<ref name="caniuse">Template:Cite web</ref>
Google Chrome and Chromium
(Blink layout engine)
Template:Yes v. 59 (5 June 2017)<ref name="Add support for Animated PNG">Template:Cite web</ref><ref>Template:Cite news</ref>
Internet Explorer
(Trident layout engine)
Template:No<ref name="caniuse" /> Template:N/A
Microsoft Edge [Legacy]
(EdgeHTML layout engine)
Template:No<ref name="caniuse" /><ref>Template:Cite web</ref> Template:N/A
Microsoft Edge
(Blink layout engine)
Template:Yes v. 79
Opera v12 and earlier
(Presto layout engine)
Template:Yes v. 9.5 (12 June 2008)<ref>Template:Cite web</ref>
Opera 15 and later
(Blink layout engine)
Template:Yes v. 46.0 (22 June 2017)<ref>Template:Cite web</ref>
Pale Moon (Goanna layout engine) Template:Yes v. 27
Mobile
browsers
iOS Safari Template:Yes<ref name="caniuse" /> v. 8.0
Firefox for Android Template:Yes<ref name="caniuse" /> Template:Dunno
Samsung Internet for Android Template:Yes v. 7.0
Opera Mobile Template:YesTemplate:Citation needed Template:Dunno
Productivity
software
LibreOffice Template:Yes<ref>Template:Cite web</ref> Planned

Template:Notelist

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

See also

References

Template:Reflist

Template:Commons category

Template:Graphics file formats Template:Compression formats