This page is somewhat incomplete and quite possibly incorrect – use with caution.

APNG tests

For all these tests, wait at least a second after all the images have downloaded, before checking that the rendered output is correct.

Test output conventions: A solid green 128×64 rectangle means success. Any red means failure. Anything else means you need to read the instructions. "Transparent" is indicated by a light yellow background.

Sections of the relevant specifications are sometimes quoted when they clarify the expected behaviour.

Please don't link directly to the images in this page, since they may get renamed and will break any such links.

You can download the script and the source data for this page.

Valid images

Basic cases

# Trivial static image.

This should be solid green.

Did not load image

(source)

# Trivial animated image - one frame; using default image.

This should be solid green.

Did not load image

(source)

# Trivial animated image - one frame; ignoring default image.

This should be solid green.

Did not load image

(source)

IDAT, fdAT splitting

There may be multiple IDAT chunks; if so, they shall appear consecutively with no other intervening chunks. The compressed datastream is then the concatenation of the contents of the data fields of all the IDAT chunks.

The compressed datastream is then the concatenation of the contents of the data fields of all the `fdAT` chunks within a frame.

# Basic split IDAT.

This should be solid green.

Did not load image

(source)

# Split IDAT with zero-length chunk.

This should be solid green.

Did not load image

(source)

# Basic split fdAT.

This should be solid green.

Did not load image

(source)

# Split fdAT with zero-length chunk.

This should be solid green.

Did not load image

(source)

Dispose ops

# APNG_DISPOSE_OP_NONE - basic.

This should be solid green.

Did not load image

(source)

# APNG_DISPOSE_OP_BACKGROUND - basic.

This should be transparent.

Did not load image

(source)

# APNG_DISPOSE_OP_BACKGROUND - final frame.

This should be solid green.

Did not load image

(source)

# APNG_DISPOSE_OP_PREVIOUS - basic.

This should be solid green.

Did not load image

(source)

# APNG_DISPOSE_OP_PREVIOUS - final frame.

This should be solid green.

Did not load image

(source)

# APNG_DISPOSE_OP_PREVIOUS - first frame.

This should be transparent.

Did not load image

(source)

Dispose ops and regions

# APNG_DISPOSE_OP_NONE in region.

This should be solid green.

Did not load image

(source)

# APNG_DISPOSE_OP_BACKGROUND before region.

This should be transparent.

Did not load image

(source)

# APNG_DISPOSE_OP_BACKGROUND in region.

This should be a solid blue rectangle containing a smaller transparent rectangle.

Did not load image

(source)

# APNG_DISPOSE_OP_PREVIOUS in region.

This should be solid green.

Did not load image

(source)

Blend ops

# APNG_BLEND_OP_SOURCE on solid colour.

This should be solid green.

Did not load image

(source)

# APNG_BLEND_OP_SOURCE on transparent colour.

This should be transparent.

Did not load image

(source)

# APNG_BLEND_OP_SOURCE on nearly-transparent colour.

This should be very nearly transparent.

Did not load image

(source)

# APNG_BLEND_OP_OVER on solid and transparent colours.

This should be solid green.

Did not load image

(source)

# APNG_BLEND_OP_OVER repeatedly with nearly-transparent colours.

This should be solid green.

Did not load image

(source)

Blending and gamma

# APNG_BLEND_OP_OVER

This should be solid slightly-dark green.

Did not load image

(source)

# APNG_BLEND_OP_OVER

This should be solid nearly-black.

Did not load image

(source)

Chunk ordering

# fcTL before acTL.

This should be solid green.

Did not load image

(source)

Delays

# Basic delays.

This should flash blue for half a second, then yellow for one second, then repeat.

Did not load image

(source)

# Rounding of division.

This should flash blue for half a second, then yellow for one second, then repeat.

Did not load image

(source)

# 16-bit numerator/denominator.

This should flash blue for half a second, then yellow for one second, then repeat.

Did not load image

(source)

# Zero denominator.

If the denominator is 0, it is to be treated as if it were 100

This should flash blue for half a second, then yellow for one second, then repeat.

Did not load image

(source)

# Zero numerator.

If the the value of the numerator is 0 the decoder should render the next frame as quickly as possible, though viewers may impose a reasonable lower bound.

This should flash cyan for a short period of time (perhaps zero), then magenta for the same short period of time, then blue for half a second, then yellow for one second, then repeat.

Did not load image

(source)

num_plays

# num_plays = 0

This should flash yellow for one second, then blue for one second, then repeat forever.

Did not load image

(source)

# num_plays = 1

When first loaded, this should flash yellow for one second, then stay blue forever.

Did not load image

(source)

# num_plays = 2

When first loaded, this should flash yellow for one second, then blue for one second, then yellow for one second, then blue forever.

Did not load image

(source)

Other depths and colour types

# 16-bit colour.

This should be dark blue.

Did not load image

(source)

# 8-bit greyscale.

This should be a solid grey rectangle containing a solid white rectangle.

Did not load image

(source)

# 8-bit greyscale and alpha, with blending.

This should be solid grey.

Did not load image

(source)

# 2-color palette.

This should be solid green.

Did not load image

(source)

# 2-bit palette and alpha.

This should be solid green.

Did not load image

(source)

# 1-bit palette and alpha, with blending.

This should be solid dark blue.

Did not load image

(source)

Invalid images

It is strongly recommended that when any error is encountered decoders should discard all subsequent frames, stop the animation, and revert to displaying the default image. A decoder which detects an error before the animation has started should display the default image. An error message may be displayed to the user if appropriate.

(If some decoders accept broken images, it seems quite possible that people will create and distribute broken images, and then the error-handling would have to be reverse-engineered by other implementations; hence all these tests to ensure errors get detected properly.)

For the following images, the default image (solid green) or an error should be displayed.

Incorrect chunks

# Missing acTL.

Did not load image

(source)

# Repeated acTL.

Did not load image

(source)

# acTL after IDAT.

Did not load image

(source)

# Missing fcTL.

Disabled for now, since it crashes Opera 9.5 alpha 1589 (bug 287173).

# Repeated fcTL.

Did not load image

(source)

# Missing fdAT.

Did not load image

(source)

num_frames

# num_frames = 0; no default image.

0 is not a valid value.

Did not load image

(source)

# num_frames = 0; ignoring default image.

0 is not a valid value.

Did not load image

(source)

# num_frames too low.

This must equal the number of `fcTL` chunks. ... If this value does not equal the actual number of frames it should be treated as an error.

Did not load image

(source)

# num_frames too high by 1.

This must equal the number of `fcTL` chunks. ... If this value does not equal the actual number of frames it should be treated as an error.

Did not load image

(source)

# num_frames too high by 2.

This must equal the number of `fcTL` chunks. ... If this value does not equal the actual number of frames it should be treated as an error.

Did not load image

(source)

# num_frames outside valid range.

an "unsigned int" shall be a 32-bit unsigned integer in network byte order limited to the range 0 to (2^31)-1

Did not load image

(source)

Sequence numbers

# Not starting from 0.

Did not load image

(source)

# Gap in sequence.

Did not load image

(source)

# Duplicated sequence number.

Did not load image

(source)

# Duplicated chunk.

Did not load image

(source)

# Reordered fdAT chunks.

Did not load image

(source)

# Reordered sequence numbers.

Did not load image

(source)

# Separated fdAT and fcTL sequences.

Did not load image

(source)

Invalid image-data sizes

# Default image's fcTL size not matching IHDR.

Did not load image

(source)

# fdAT too small.

Did not load image

(source)

# fdAT too large.

Did not load image

(source)

References