Animated Portable Graphics (APG) Format Model
Editor
"Goals" and "Design Model" sections extracted and revised from the
APG-0.94.4 proposal
Version 0.94.4-1, 30 September 2015
The current version of this document and the full APG proposal
may be found at
Some version of this document may be used to update the "Goals" and
"Design Model" sections of a future version of the APG proposal.
Comments on this document can be sent to the editor or to the
PNG specification maintainers at one of the following addresses:
Distribution of this memo is unlimited.
This should have been written first!
- Format for storing and transmitting animations compactly.
- Avoid the complexity of MNG.
- Accommodate both lossless (PNG) and lossy (JPEG) images.
- Allow "sprite" animation (reuseable images).
- Ability to accomplish GIF "restore_to_previous" disposal efficiently.
- Allow transparent animations in which opaque areas can
become transparent again.
- Allow variable interframe delays.
- Allow images to be displayed on-the-fly as they are decoded, or
to be stored for later use. MNG allowed both to happen at once but
APG does not allow that.
- No requirement for images to be stored or transmitted in a concrete
lossless form. This does not accommodate MNG-style delta images; in
MNG terms, all objects are "abstract".
- No MNG "concrete" images required. All objects should be "abstract".
- Allow looping of the entire animation or parts of it.
This should have been written second!
- General
- The APG format is like PNG, with an 8-byte signature and PNG-style chunks.
- An APG animation consists of a sequence of frames together with timing
information (interframe delay and timeout). Times are expressed in "ticks"
and each frame can have its own interframe delay and timeout.
- Frames
- Frames are delimited by layers that have a non-zero interframe delay.
- Each frame consists of the coalescence of zero or more layers with
zero time delay followed by one layer with a non-zero time delay. The
frame itself inherits that non-zero time delay and the timeout from the
final layer.
- Frames can have transparency or an alpha channel.
- A frame has the dimensions specified on the MHDR chunk. Any areas
not defined by any layer are unchanged from the previous frame.
- Layers
- An APG decoder creates a sequence of layers, each with a time delay, which
can be zero or a positive number, and optionally a timeout.
- Layers can have transparency or an alpha channel.
- A layer is created by decoding an image into Object 0 or by using the
PAST or PLAY chunk to copy a stored object in Object 0.
- A layer has its own dimensions and location with respect to the upper
left corner of the animation as specified on the MHDR chunk. These dimensions
and location are provided by the DEFI, PAST, or PLAY chunk that created
the layer.
- Objects
- Images are handled internally as numbered objects.
- Each object has an associated set of attributes (dimensions, location, etc.)
- Object 0 is special in that it is not stored internally,
as it is intended for immediate on-the-fly output.
- Object 0 is always immediately output (this is a change from versions
0.93.3 and earlier, and from MNG).
- Other objects are sent to the output by composing or copying them
into Object 0.
- A decoder has write-only access to Object 0.
- Any object, including Object 0, can have transparency or an alpha channel.
- Object 0, but not necessarily any other object, has an associated
interframe delay and timeout.