请输入您要查询的百科知识:

 

词条 APNG
释义

  1. History

  2. Support

  3. Technical details

  4. Alternatives

      Raster formats    Vector formats    Scripting and other methods  

  5. References

  6. External links

{{other uses}}{{Infobox file format
| name = Animated Portable Network Graphics
| screenshot =
| caption = An animated PNG (displays as static image in some web browsers)
| extension = .png .apng
| mime =
| owner =
| creatorcode =
| genre = animated raster image format
| containerfor =
| containedby =
| released = {{start date and age|2008|08|04}}
| extendedfrom = PNG
| extendedto =
|free = yes
}}

The Animated Portable Network Graphics (APNG) file format is an 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.

As of 22 June 2017, the only well-known web browsers not to support APNG are Internet Explorer (discontinued) and Microsoft Edge.

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);[1] 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.[2] 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)[3] while insisting on the use of the .png extension instead of .apng, leading to the format not being approved by the PNG Development Group.[4]

The PNG group officially rejected APNG as an official extension on April 20, 2007.[5] There have been several subsequent proposals for a simple animated graphics format based on PNG using several different approaches.[6]

Mozilla Firefox added support for APNG in version 3 trunk builds on March 23, 2007.[17] 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.[18]

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.[19] In 2010 Commercial Radio Broadcasters in Sydney began to include APNG animations in DAB+ digital radio broadcasts.{{Citation needed|date=December 2010}} 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.{{Citation needed|date=December 2010}}{{Update inline|reason=Did they?|date=July 2015}}

Mozilla's role in extending the PNG format to APNG echoes Netscape's much earlier role in popularizing animated GIFs.{{Citation needed|date=December 2013}}

In 2016, Apple adopted the APNG format as the preferred format for animated stickers in iOS 10 iMessage apps.[20]

On March 15, 2017 APNG support was added to Chromium.[21] This leaves Microsoft Edge's EdgeHTML and Internet Explorer's Trident rendering engines as the only engines to not support the format.

Support

{{See also|Comparison of layout engines (graphics)#Image format support}}{{See also|Comparison of web browsers#Image format support}}
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 {{yes}} v. 1[22]
cphktool APNG Anime Maker {{yes}} v. 1 (9 June 2009)[23]
APNG Disassembler {{yes}} v. 1 [24]
APNG Optimizer {{yes}} v. 1.0 (28 March 2011)[25]
FFmpeg {{yes}}[26] v. 2.7[27]
Gamani GIF Movie Gear {{yes}} v. 4.2 (March 2008)[28]
GIMPNeeds plug-in}}[29] {{N/A}}
ImageJ {{yes}} v. 1.41g (3 July 2008)[30]
Imagine {{yes}} v. 1.0.2 (4 May 2008)[31]
IrfanViewRead-only}} v. 4.40 (31 July 2015)
Konvertor {{yes}} v. 4.02 (May 2010)[32]
KSquirrel {{yes}} v. 0.7.2 (3 October 2007)[33]
Paint.NETNeeds plugin}}[34] {{N/A}}
RealWorld Paint {{yes}} v. 2011.1 (December 2011)[35]
VirtualDubNeeds plugin}}[36]{{efn|After loading a video, an APNG file can be created via the "File{{!}}Export{{!}}Animated PNG" menu item.}} {{N/A}}
XnViewRead-only}} v. 1.97.4 (30 April 2010)[37]
Sciter and HTMLayout UI enginesRead-only}} since 2008
Krita {{no}}[38] {{N/A}}
Browser
Engines
Webkit {{yes}} (17 March 2015)[39]
Blink {{yes}} June 2017
Web
browsers
Mozilla Firefox
(Gecko layout engine)
{{yes}} v. 3 (17 June 2008)[40][41]
SeaMonkey
(Gecko layout engine)
{{yes}} v. 2
Iceweasel and other Debian rebrandings
(Gecko layout engine)
{{yes}} v. 4.0~b12[18]
Safari
(WebKit layout engine)
{{yes}} v. 8.0[42]
Google Chrome and Chromium
(Blink layout engine)
{{yes}} v. 59 (5 June 2017)[43][44]
Internet Explorer
(Trident layout engine)
{{no}}[42] {{N/A}}
Microsoft Edge
(EdgeHTML layout engine)
{{no}}[42][45] {{N/A}}
Opera v12 and earlier
(Presto layout engine)
{{Yes}} v. 9.5 (12 June 2008)[46]
Opera 15 and later
(Blink layout engine)
{{Yes}} v. 46.0 (22 June 2017)[47]
Pale Moon (Goanna layout engine) {{Yes}} v. 27
Mobile
browsers
iOS Safari {{yes}}[42] v. 8.0
Firefox for Android {{yes}}[42] {{dunno}}
Samsung Internet for Android {{yes}} v. 7.0
Opera Mobiledate=November 2017}} {{Dunno}}
{{notelist}}

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

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).

Structure of a single PNG chunk
Length
(4 bytes)
Chunk type
(4 bytes)
Chunk data
(length bytes)
CRC
(4 bytes)

There are about 20 different chunk types, but for a minimal PNG, only 3 are required: The IHDR (image header) chunk, one or more IDAT (image data) chunks and the IEND (image end) chunk.

Structure of a very simple PNG file
89 50 4E 47 0D 0A 1A 0A
PNG signature
IHDR
Image header
IDAT
Image data
IEND
Image end

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).

Hex As Characters
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
00 00 00 01 00 00 00 01 08 02 00 00 00 90 77 53
DE 00 00 00 0E 49 44 41 54 78 DA 62 F8 CF C0 00
10 60 00 03 01 01 00 66 FD 9F 24 00 00 00 00 49
45 4E 44 AE 42 60 82
.PNG........IHDR
..............wS
Þ....IDATxÚbøÏÀ.
.`.....fý.$....I
END®B`.

The [https://wiki.mozilla.org/APNG_Specification APNG specification] introduces three new chunks: The animation control chunk ([https://wiki.mozilla.org/APNG_Specification#.60acTL.60:_The_Animation_Control_Chunk acTL]), the frame control chunk ([https://wiki.mozilla.org/APNG_Specification#.60fcTL.60:_The_Frame_Control_Chunk fcTL]) and the frame data chunk ([https://wiki.mozilla.org/APNG_Specification#.60fdAT.60:_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[49] should an APNG-unaware PNG editor re-order them as allowed by PNG chunk ordering rules.[50]

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 (acTL) after the image header chunk (IHDR).
  3. If the first PNG is to be part of the animation, insert a frame control chunk (fcTL) before the image data chunk (IDAT).
  4. 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.

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.

Alternatives

Raster formats

The MNG file format is a more powerful alternative to APNG, although it's a more complex format.{{Citation needed|date=November 2012}} It also has less web browser support. Mozilla and Netscape browsers removed the MNG support in 2003,[51] 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, but no transparency.

Google WebP also supports Truecolor 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[52] or plugin based technologies like Adobe Flash, Microsoft Silverlight and Java.

References

1. ^{{cite web|url=https://bugzilla.mozilla.org/show_bug.cgi?id=18574#c72 |title=Bug 18574 - (mng) restore support for MNG animation format and JNG image format|date=1999-11-11|author=martin|accessdate=2010-03-30|publisher=Mozilla}}
2. ^{{cite web|url=http://www.libpng.org/pub/png/spec/1.1/PNG-Misc.html#Multiple-image-extension|title=PNG (Portable Network Graphics) Specification, Version 1.1#8.4. Multiple-image extension|publisher=libpng|accessdate=2010-03-30}}
3. ^{{cite web|url=https://wiki.mozilla.org/APNG_Specification#MIME_type|title=APNG Specification, Version 1.0#MIME type|publisher=Mozilla|accessdate=2017-12-10}}
4. ^{{cite web|url=https://github.com/ImageMagick/ImageMagick/issues/24#issuecomment-136362187|title=ImageMagick can't detect animated PNG|accessdate=2017-12-10}}
5. ^{{cite web|url=http://sourceforge.net/mailarchive/message.php?msg_id=131482|title=VOTE FAILED: APNG 20070405a|publisher=SourceForge mailing list|date=2007-04-20}}
6. ^{{cite web|url=http://gjuyn.xs4all.nl/pnganim.html|title=Discussion for a simple "animated" PNG format|archivedate=2009-02-26|archiveurl=https://web.archive.org/web/20090226103407/http://gjuyn.xs4all.nl/pnganim.html|accessdate=2011-07-12}}
7. ^Fallback of GIF encapsulated formats is animated.
8. ^may lose the entire animation
9. ^may lose the animation details, but not the image data
10. ^may lose the high-quality PNG image data
11. ^Frame composition from multiple parts of the image
12. ^not in the current proposal, but could be made possible though only for a single sprite!
13. ^Supports both PNG and JNG simultaneously
14. ^A distinction between still and animated files can be made visible on file-level by using special extension and mime-type, but cannot be enforced.
15. ^A distinction between still and animated files is not visible on file-level, but this is an existing problem for the GIF extension.
16. ^Ani-PNG is a new subset of MNG that does not need formal approval, but it uses new PlAY and ReCO chunks which are not yet officially registered.
17. ^{{cite web|url=https://www.mozilla.org/projects/firefox/3.0a3/releasenotes/ |title=Gran Paradiso Alpha 3 release notes |publisher=Mozilla |date=2007-03-23 |accessdate=2010-03-30 |archiveurl=https://web.archive.org/web/20091226221450/http://www.mozilla.org/projects/firefox/3.0a3/releasenotes/ |archivedate=December 26, 2009 |deadurl=yes }}
18. ^{{cite web|url=http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486827#43|title=Debian Bug #486827 Iceweasel cannot render APNG image|date=2011-08-26|publisher=Debian|accessdate=2011-09-18}}
19. ^{{cite web|title=Digital Audio Broadcasting (DAB); MOT SlideShow; User Application (pdf) Specification|url=http://www.etsi.org/deliver/etsi_ts/101400_101499/101499/02.02.01_60/ts_101499v020201p.pdf|publisher=ETSI|accessdate=30 January 2013}}
20. ^{{Cite web|url=https://developer.apple.com/ios/human-interface-guidelines/extensions/messaging/|title=Messaging - Extensions - iOS Human Interface Guidelines|last=Inc.|first=Apple|website=developer.apple.com|access-date=2016-10-12}}
21. ^{{Cite web|url=http://anzwix.com/a/Chromium/Add%20Support%20For%20Animated%20PNG|title=Anzwix / Chromium / Add support for Animated PNG|access-date=2017-03-15}}
22. ^{{cite web|url=https://sourceforge.net/projects/apngasm/|title=APNG Assembler|author=maxst|work=SourceForge}}
23. ^{{cite web|url=http://sites.google.com/site/cphktool/apng-anime-maker|title=cphktool APNG Anime Maker|publisher=cphktool|accessdate=2010-06-28}}
24. ^{{cite web|url=http://apngdis.sourceforge.net/|title=APNG Disassembler|author=maxst|work=SourceForge}}
25. ^{{cite web|url=https://sourceforge.net/projects/apng/files/APNG_Optimizer/|title=APNG Optimizer|author=maxst|work=SourceForge}}
26. ^https://www.ffmpeg.org/ffmpeg-formats.html#apng
27. ^{{cite web|url=https://github.com/FFmpeg/FFmpeg/blob/master/Changelog|title=GitHub changelog of FFmpeg|accessdate=2016-07-09}}
28. ^{{cite web|url=http://www.gamani.com/apng.htm|title=Animated PNG: Simple Animation with an Alpha Channel|publisher=Gamani|accessdate=2009-08-25}}
29. ^{{cite web|url=http://registry.gimp.org/node/24394|title=APNG Plug-In|publisher=}}
30. ^{{cite web|url=http://rsb.info.nih.gov/ij/notes.html|title=ImageJ News|publisher=ImageJ|accessdate=2009-05-23| archiveurl= https://web.archive.org/web/20090521092716/http://rsb.info.nih.gov/ij/notes.html| archivedate= May 21, 2009 | deadurl= no}}
31. ^{{cite web|url=http://nyam.pe.kr/dev/imagine/doc/Whatsnew.txt |title=Imagine - What's new |accessdate=2017-09-01 |deadurl=no |archiveurl=https://web.archive.org/web/20111008163945/http://nyam.pe.kr/dev/imagine/doc/Whatsnew.txt |archivedate=October 8, 2011 }}
32. ^{{cite web|url=http://www.konvertor.net/indexe.html|title=Konvertor - Solutions for Multimedia Processing|access-date=2010-05-19|archive-url=https://web.archive.org/web/20100512174247/http://www.konvertor.net/indexe.html|archive-date=2010-05-12|dead-url=yes|df=}}
33. ^{{cite web|url=http://ksquirrel.sourceforge.net/changelog.php|title=ksquirrel Changelog Sektion: ksquirrel-0.7.2|publisher=SourceForge|accessdate=2009-05-23}}
34. ^{{cite web|url=http://forums.getpaint.net/index.php?/topic/13454-animated-image-24-agif-apng/|title=Animated Image 2.4 - AGIF & APNG|work=Paint.NET Forum}}
35. ^{{cite web|url=http://www.rw-designer.com/entry/390|title=APNG support announcement}}
36. ^{{cite web|url=http://vdubapngmod.sourceforge.net|title=SourceForge.net: VirtualDub APNG Mod|publisher=}}
37. ^While XnView is available for several operating systems, only versions for Windows have been released since APNG support was added.
38. ^{{cite web |url=https://bugs.kde.org/show_bug.cgi?id=342479|title=APNG export support|accessdate=2018-09-18}}
39. ^{{cite web|url=http://trac.webkit.org/changeset/181632|title=Animated PNG graphics|date=Mar 17, 2015|publisher=Webkit|accessdate=2015-03-17}}
40. ^{{cite web|url=https://developer.mozilla.org/en/Animated_PNG_graphics|title=Animated PNG graphics|date=July 4, 2008|first=Stuart|last=Parmenter|author2=Vladimir Vukicevic |author3=Andrew Smith |publisher=Mozilla|accessdate=2009-05-23|work=Mozilla Developer Center}}
41. ^{{cite web|url=https://developer.mozilla.org/en/Firefox_3_for_developers |title=Firefox 3 for developers |date=October 1, 2008 |publisher=Mozilla |accessdate=2009-05-23 |work=Mozilla Developer Center |deadurl=yes |archiveurl=https://web.archive.org/web/20081113072436/https://developer.mozilla.org/en/Firefox_3_for_developers |archivedate=2008-11-13 |df= }}
42. ^{{cite web |url=http://caniuse.com/#feat=apng |title=Animated PNG (APNG) |website=Can I use... Support tables for HTML5, CSS3, etc}}
43. ^{{cite web|url=https://chromium.googlesource.com/chromium/src/+/7d2b8c45afc9c0230410011293cc2e1dbb8943a7|title=Add support for Animated PNG}}
44. ^{{Cite news|url=https://chromereleases.googleblog.com/2017/06/stable-channel-update-for-desktop.html|title=Stable Channel Update for Desktop|work=Chrome Releases|access-date=2017-06-06|language=en-US}}
45. ^{{cite web |url=https://developer.microsoft.com/en-us/microsoft-edge/platform/status/apngimageformat/ |title=The status of APNG image format in Microsoft Edge |website=Microsoft Edge Development |accessdate=2017-07-29 }}
46. ^{{cite web|url=http://www.opera.com/docs/specs/opera95/#graphics|title=Web specifications supported in Opera 9.5|publisher=Opera Software|accessdate=2009-05-23}}
47. ^{{cite web|url=http://blogs.opera.com/desktop/2017/06/opera-46-goes-final-more-quality-and-operas-first-tv-ad/|title=Opera 46 goes final, more quality and Opera’s first TV ad|publisher=Opera Software|accessdate=2017-06-26}}
48. ^{{cite web|url=https://github.com/davidmz/apng-canvas|title=APNG-canvas Library}}
49. ^[https://wiki.mozilla.org/APNG_Specification#Chunk_Sequence_Numbers Chunk Sequence Numbers] (APNG spec)
50. ^Chunk Ordering Rules (PNG 1.2 spec)
51. ^[https://bugzilla.mozilla.org/show_bug.cgi?id=195280 Bug 195280 – Removal of MNG/JNG support]
52. ^{{cite web|url=http://blenheimears.com/anipng_demo/|title=AniPNG Demonstration|date=2008-12-08}}

External links

{{Commons category|Animated PNG}}
  • The APNG specification at mozilla.org’s Wiki
  • [https://sourceforge.net/projects/libpng-apng/ APNG patch for libpng]
  • [https://web.archive.org/web/20080420192652/http://people.mozilla.com/~dolske/apng/demo.html 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
  • [https://chrome.google.com/webstore/detail/ehkepjiconegkhpodgoaeamnpckdbblp APNG extension for Google Chrome]
  • [https://itunes.apple.com/tw/app/id447928057 APNG viewer utility for iOS]
  • AJAX loading animations in APNG
  • [https://addons.opera.com/en/extensions/details/screenshoter/?display=en Opera extension for APNG creation from screenshots]
  • apngasm - FOSS Animated PNG tools and APNG standardization
  • Animizer.net - Web application for creating and editing APNG
  • [https://onedrive.live.com/redir?resid=54d7da9cdef82b01!27581&authkey=!ABTsVDGMPEvdcBQ&ithint=folder%2ctxt Trying to add APNG support in native level of Chromium (also Android support)]
  • [https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/2xvXNJMsgxc APNG consideration in the Chromium development group]
{{Graphics file formats}}{{Compression formats}}{{DEFAULTSORT:Apng}}

5 : Graphics file formats|Computer-related introductions in 2004|Mozilla|Open formats|PNG

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/13 13:33:30