Changes

Jump to: navigation, search

APNG Specification

32 bytes removed, 23:03, 22 March 2007
no edit summary
To be recognized as an APNG, an `acTL` chunk must appear in the stream before any `IDAT` chunks. The `acTL` structure is described in the next section.
An `fcTL` chunk must may also appear before `IDAT`, providing frame information for the first frame encoded in the PNG stream's `IDAT` chunks, known as frame 0. If there is no fCTl fcTL chunk before IDAT, then frame 0 is intialized to RGBA(0,0,0,0) and the IDAT chunks are not used.
Subsequent frames are encoded in `fdAT` chunks containing almost the same structure of content as IDAT chunks. Information for each frame about placement and rendering is stored in `fcTL` chunks. The full layout of `fdAT` and `fcTL` chunks is described below.
The `fcTL` and `fdAT` chunks have a 4 byte sequence number. Both chunk types share the sequence. The purpose of this number is to detect (and optionally correct) sequence errors in an Animated PNG, since the PNG specification does not impose orderng restrictions on ancillary chunks.
The first fCTl fcTL chunk must contain sequence number 0, and the sequence numbers in the remaining fCTl fcTL and fDAt fdAT chunks must be in order, with no gaps or duplicates.
The table below illustrates the use of sequence numbers for images with more than one frame and more than one `fdAT` chunk:
Sequence number Chunk
0 fCTl fcTL describing frame 1 1 first fDAt fdAT for frame 1 2 second fDAt fdAT for frame 1
....
* For the second frame, the `fcTL` chunk must appear after the `IDAT` chunks from the first frame and before the fdAT chunks for the second frame.
* For any subsequent frames, the `fcTL` chunk for the frame N must appear after the `fdAT` chunks from the frame N-1 and before the fdAT chunks for the frame N.
* Other ancillary chunks are allowed to appear among the APNG chunks, including between fDAt chunks. Decoders must ignore such fdAT chunks.
The fCTl fcTL chunk is mandatory for every frame except for frame 0. When it is present for frame 0, decoders must render frame 0 from the data in the IDAT chunks. When it is not present for frame 0, frame 0 is a transparent black frame (all pixels are RGBA(0,0,0,0)) and the IDAT chunks are ignored. More than one fCTl fcTL chunk per frame is not allowed.
Format:
4 APNG_DISPOSE_OP_PREVIOUS
* APNG_DISPOSE_NONEAPNG_DISPOSE_OP_NONE: no disposal is done on this frame before rendering the next; its contents are left on the output buffer. This is the default.
* APNG_DISPOSE_OP_BACKGROUND: the frame's region is to be cleared to the background color. If no bKGD chunk is specified, the result is fully transparent black (r, g, b, and a all 0).
* APNG_DISPOSE_OP_PREVIOUS: the frame's region is to be reverted to the previous contents.
The `fdAT` chunk has the same purpose as an `IDAT` chunk. It has the same data structure as an `IDAT` chunk, except a sequence number is appended in the beginning.
Each frame must contain at least one fDAt fdAT chunk. The compressed datastream is then the concatenation of the contents of the data fields of all the fDAt fdAT chunks within a frame. When decompressed, the datastream is a complete PNG image, including the filter byte at the beginning of each scanline. It utilizes the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the main image.
Format:
48
edits

Navigation menu