Animated PNG

PNG images have rightly superseded GIFs for many small images on the web, with many well-known advantages over the older format. However, one area where PNG lags behind is its lack of an equivalent for small animations, for which animated GIFs are still the preferred format. Although efforts are under way to create an animated PNG format, it will be some time before it is widely supported.

In the meantime, AnimatedPNG is a Javascript library that takes a sequence of individual PNG images and draws them in turn, creating the functional equivalent of the animated GIF. The library is designed to be as simple to use as possible, with just two lines of javascript to draw a basic animation, and a few extra functions for more detailed control of the animation. Further details for using the library can be found on the example page.


There are no special requirements for using the AnimatedPNG library. All you need is the library file itself, and a set of suitably named PNG image files.


The AnimatedPNG library has been tested with the following browsers:

  • Firefox 2.0+
  • Safari 2.0+
  • Internet Explorer 6+

The library does not use any particularly complex Javascript, so it should work well with any modern web browser. However, if you find a browser that has trouble with the library, please let me know.

Installation and Usage

The AnimatedPNG library is supplied as a .tar.gz or .zip file, and contains the following files:

animatedpng.js The javascript library in compressed form – use this in your web page.
animatedpng_large.js The javascript library in verbose form, which is easier to understand and modify.
README.txt A readme file giving an overview of how to use the library.

Full details of the API for the Javascript library can be found on the API Page.

Note: Since this library uses individual image files for its frames, it is suitable only for short, simple animations. Longer animations will work, but it may produce odd results while all the images load.

Latest Release

The latest version is 1.02, available for download as follows:

See the Changelog for what’s new.

AnimatedPNG is released under the terms of the GNU Public License.

Leave a Reply