Closed wolflink2021 closed 1 year ago
Bear in mind that APNG is an explicit violation of the PNG spec and Mozilla has to maintain their own fork of libpng
to support it because the PNG spec people have said it will never be accepted into the reference implementation.
The first eight bytes of a PNG datastream always contain the following (decimal) values:
137 80 78 71 13 10 26 10
This signature indicates that the remainder of the datastream contains a single PNG image, consisting of a series of chunks beginning with an IHDR chunk and ending with an IEND chunk.
-- https://www.w3.org/TR/PNG/#5DataRep
b. The reference image, which only exists conceptually, is a rectangular array of rectangular pixels, all having the same width and height, and all containing the same number of unsigned integer samples, either three (red, green, blue) or four (red, green, blue, alpha). [...]
c. The PNG image is obtained from the reference image by a series of transformations: alpha separation, indexing, RGB merging, alpha compaction, and sample depth scaling. [...]
-- https://www.w3.org/TR/PNG/#4Concepts.Sourceimage
PNG also does not support multiple images in one file. This restriction is a reflection of the reality that many applications do not need and will not support multiple images per file. In any case, single images are a fundamentally different sort of object from sequences of images. Rather than make false promises of interchangeability, we have drawn a clear distinction between single-image and multi-image formats. PNG is a single-image format.
(TL;DR: The PNG spec is designed to leave the door open for embedded thumbnails/mipmapping but disallow any other kind of secondary images within the same PNG file.)
When I'm processing PNG and I suspect APNG to be present, I waste the extra CPU cycles parsing and saving the PNG files in order to normalize them and strip any spec violations. (And yes, I'm aware that will also discard any chunks with unrecognized types that follow the naming convention for indicating that they should be discarded while processing if unrecognized.)
...I'd be much less hostile to APNG if Mozilla didn't also make a web browser that still has nothing along the lines of img { animate: none; }
CSS for devs who accept user-generated content to use.
No.
We're using FreeImage to read images and this lib does not support apng. It would require to rewrite everything when loading images by changing the library.
Anyway if you want animated images, you have many other solutions :
APNG animations can be used on elements not yet supported by storyboards