APNG Animation using APNG Assembler (CUI)

Table of Content

GIF animation has been popular since long ago, but in recent years APNG animation (Animation consisting of a time series of PNG files) seems to be becoming popular and supported by the latest major browsers, including Google Chrome. As software to create APNG, APNG Assembler (apngasm) is a standard. Although there is a GUI version on Windows, from the consistency with the Linux environment, I will summarize the creation method using the CUI version.

Install APNG Assembler

APNG Assembler web site. Download an appropriate file from List of files. For example, Windows 64 bit CUI binary is apngasm-2.91-bin-win64.zip and Linux CUI binary is apngasm-2.91-bin-linux.zip. Although you may install it on Ubuntu by [cci]sudo apt install apngasm[/cci], for consistency among systems, downloading a binary version is recommended.
After downloading it, extract it and copy it to a directory where PATH is set.

Create an animation

Open a command prompt for Windows or Linux. Suppose that a series of PNG files having continuous numbers
like [cci]frame000.png[/cci] and [cci]frame001.png exist and the output animation file is [cci]animation.png[/cci].
Then you can create an animation as follows:
[cc]
apngasm64 animation.png frame*.png 1 4
[/cc]
where arguments appearing after png file name are options and [cci]1 4[/cci] means the frame rate of [cci]4fps[/cci] or [cci]1/4 s[/cci]. All the options are listed here and below:
[cc]
1 10 : frame delay is 1/10 sec. (default)
-l2 : 2 loops (default is 0, forever)
-f : skip the first frame
-hs## : input is horizontal strip of ## frames (example: -hs12)
-vs## : input is vertical strip of ## frames (example: -vs12)
-kp : keep palette
-kc : keep color type
-z0 : zlib compression
-z1 : 7zip compression (default)
-z2 : Zopfli compression
-i## : number of iterations (default -i15)
[/cc]

Show animation

It is easiest to open the animation.png using Chrome. When [cci]animation.png[/cci] file exists under C drive on Windows, open the browser specifying the file path as follows:
[cc]
file:///C:/home/output/png/animation.png
[/cc]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.