{"id":"image-vnd-mozilla-apng","mimeType":"image/vnd.mozilla.apng","name":"Animated Portable Network Graphics","shortName":"APNG","category":"Web \u0026 Animation","extensions":[".apng",".png"],"description":"The image/vnd.mozilla.apng MIME type (now officially standardized by IANA as image/apng) represents the Animated Portable Network Graphics format. Created by Mozilla in 2004, APNG was designed as a modern replacement for the animated GIF. It extends the standard PNG specification to support animation while adding true 8-bit alpha transparency and 24-bit color depth. Crucially, APNG is fully backward compatible; viewers that do not support animation will simply ignore the animation chunks and display the first frame as a standard, high-quality static PNG.","seo":{"title":"image/vnd.mozilla.apng MIME Type | Developer Reference for APNG","description":"Complete reference for the APNG format (Animated PNG): difference from GIFs, alpha transparency, magic bytes, backward compatibility, and developer snippets.","faqs":[{"question":"Why should I use APNG instead of an animated GIF?","answer":"GIFs are limited to a 256-color palette and 1-bit binary transparency (a pixel is either fully transparent or fully opaque, leading to jagged white halos). APNG supports 24-bit true color and 8-bit alpha transparency, allowing for smooth drop shadows and anti-aliased edges over any background color."},{"question":"Do APNG files use the .png or .apng file extension?","answer":"Most APNG files simply use the standard .png extension to maintain backward compatibility with software that doesn't recognize .apng. Because the underlying file structure is a valid PNG, legacy software will just display the first frame of the animation."},{"question":"How do I detect if a PNG is actually an animated APNG programmatically?","answer":"Because both share the same magic bytes (89 50 4E 47), you cannot just check the file header. You must parse the internal PNG chunks. An APNG is identified by the presence of an 'acTL' (Animation Control) chunk located before the first 'IDAT' (Image Data) chunk."}]},"index":{"compression":["Deflate (Lossless)"],"browserSupport":{"score":5,"label":"Excellent"},"commonUses":["High-Quality Web Animations","Stickers (Apple iMessage, LINE, Discord)","UI Loaders with Alpha Transparency","GIF Replacement"]},"technical":{"magicBytes":{"hex":"89 50 4E 47 0D 0A 1A 0A","ascii":"\\x89PNG\\r\\n\\x1a\\n"},"container":"PNG Chunk Stream","compressionAlgorithm":["Deflate (zlib)"],"colorDepth":["8-bit (Indexed)","24-bit (TrueColor)","32-bit (RGBA)"],"transparency":true,"animation":true,"metadata":{"exif":true,"xmp":true,"iccProfile":true},"alphaChannel":true,"progressiveLoading":true,"hdrSupport":false},"history":{"developer":"Mozilla Corporation (Stuart Parmenter \u0026 Vladimir Vukićević)","released":"2004","specification":"APNG Specification"},"browserSupport":{"chrome":true,"chromeVersion":"59","firefox":true,"firefoxVersion":"3","safari":true,"safariVersion":"8","edge":true,"edgeVersion":"79","internetExplorer":false},"softwareSupport":[{"name":"FFmpeg","logo":""},{"name":"ImageMagick","logo":"image-magic.webp"},{"name":"Ezgif","logo":""},{"name":"Affinity Photo","logo":""}],"conversion":{"convertTo":["gif","webp","avifs"],"convertFrom":["gif","webp","png (sequence)"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/apng"},{"header":"Content-Type","value":"image/vnd.mozilla.apng"}],"htmlAccept":"image/apng, image/vnd.mozilla.apng, .apng","fileDetection":["Check the standard PNG magic bytes: 89 50 4E 47 0D 0A 1A 0A.","Iterate through the PNG chunks reading the 4-byte chunk type headers.","If you encounter the ASCII string 'acTL' (Animation Control) before encountering an 'IDAT' (Image Data) chunk, the file is an APNG."]},"prosCons":{"pros":["Supports 8-bit alpha transparency, completely solving the ugly 'white halo' problem inherent to GIFs","Gracefully degrades; viewers that do not support APNG will render a perfectly valid, static PNG of the first frame","Provides lossless compression that retains absolute pixel-perfect quality for UI elements and line art"],"cons":["Because it relies on lossless Deflate compression, file sizes for complex, video-like animations can be massive compared to lossy formats like WebP or AVIF","Was initially rejected by the official PNG group, delaying its adoption for nearly a decade","Lacks native hardware decoding acceleration, unlike video-based animated formats (like MP4 or WebM)"]},"specifications":{"url":"https://wiki.mozilla.org/APNG_Specification","rfc":"","mimeAliases":["image/apng","image/png"]},"developerSnippets":{"python":"import magic\n# Libmagic will typically identify APNGs simply as 'image/png' due to the shared header\nprint(magic.from_file('animation.png', mime=True)) # Outputs 'image/png'","nodejs":"const fs = require('fs');\n// Sniffing for the 'acTL' chunk to differentiate APNG from PNG\nconst buffer = fs.readFileSync('animation.png');\n// In a real app, you'd parse lengths, but a quick brute-force indexOf for 'acTL' works for basic detection\nconst isAPNG = buffer.indexOf(Buffer.from('acTL')) \u003e -1;\nconsole.log('Is APNG:', isAPNG);","go":"import \"bytes\"\n// Go's standard library net/http will return 'image/png'.\n// To detect APNG, search the initial bytes for the acTL chunk:\n// isAPNG := bytes.Contains(buf[:1024], []byte(\"acTL\"))","php":"$mime = mime_content_type('animation.png');\necho $mime; // Standard setups will resolve this to 'image/png'. Custom binary parsing is needed to detect the acTL chunk."},"relatedFormats":["png","gif","webp","avifs"]}
