Awesome Open Source
Awesome Open Source


macOS and Linux Build Windows Build

Convert your animated png files to animated webp files.


usage: apng2webp [-h] [-l [LOOP]] [-bg [BGCOLOR]] [-tmp [TMPDIR]]
                    input [output]

Convert animated png files (apng) to animated webp files.

positional arguments:
  input                 Input path. Must be a .png file.
  output                Output path. If output file already exist it will be

optional arguments:
  -h, --help            show this help message and exit
  -l [LOOP], --loop [LOOP]
                        Passed to webpmux. The amount of times the animation
                        should loop. 0 to 65535. Zero indicates to loop
  -bg [BGCOLOR], --bgcolor [BGCOLOR]
                        Passed to webpmux. The background color as a A,R,G,B
                        tuple. Example: 255,255,255,255
  -tmp [TMPDIR], --tmpdir [TMPDIR]
                        A temp directory (it may already exist) to save the
                        temp files during converting, including the extracted
                        PNG images, the metadata and the converted WebP static
                        images for each frame. If not provided, it will use
                        the system temp path and remove temp images after


apng2webp ./input.png
apng2webp ./input.png ./output.webp
apng2webp -loop 3 -bgcolor 255,255,255,255 -tmpdir ./ ./input.png ./output.webp


  • python (python 2 or 3 can be used)
  • cmake
  • libpng
  • zlib
  • jsoncpp
  • pip (a python package used during installation)
  • The cwebp program must be in your PATH
  • The webpmux program must be in your PATH


If you prefer to use the static linking precompiled binary but not build from source, go to the release page and download apng2webp_dependencies for your platform. Then add the extracted folder to your PATH.

You also need python and pip installed, make sure cwebp and webpmux from webp to be in your PATH. Then check the installation part to install.

Build Setup


  • Use easy_install to install pip.
  • Use Homebrew to install all the dependencies.
sudo easy_install pip
brew update
brew install cmake
brew install webp
brew install jsoncpp

Linux (Debian)

  • Use webp to install cwebp and webpmux to your PATH.
  • Use apt-get to install all the dependencies.
sudo apt-get update
sudo apt-get install python
sudo apt-get install python-pip
sudo apt-get install cmake
sudo apt-get install libpng-dev
sudo apt-get install libjsoncpp-dev


  • Use python to install python and pip.
  • Use cmake to install cmake.
  • Use webp to install cwebp and webpmux to your PATH.
  • Use Mysys2 and MinGW-w64 to install external dependencies. Remember to add your MinGW-w64 folder(e.g. C:\msys64\mingw64\bin for 64bit and C:\msys64\mingw32\bin for 32bit) to your PATH.

Run Mysys2 shell(but not PowerShell) to install external dependencies.

pacman -Sy
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-make
pacman -S mingw-w64-x86_64-libpng
pacman -S mingw-w64-x86_64-jsoncpp

If you are using 32bit Windows, change all the command x86_64 to i686.

Additionally, current version mingw-w64-x86_64-make 4.2.1 has a dynamic link bug and can not run, if you are facing this issue, try pacman -S mingw-w64-x86_64-gettext to fix.


macOS and Linux

For macOS and Linux user, run terminal shell.

In apng2webp_dependencies/ execute:

mkdir build
cd build
cmake ..
(sudo) make install


For Windows user, run PowerShell as Administrator user.

In apng2webp_dependencies/ execute:

mkdir build
cd build
cmake .. -G "MinGW Makefiles"

Then add the output apngdisraw.exe and apng2webp_apngopt.exe to your PATH.


In project root folder execute:

(sudo) python install


In project root folder execute:

(sudo) pip install pytest
python test


APNG Disassembler
APNG Optimizer


Not all software within this project uses the same license. The following licenses/legal terms are used:

  • zlib license
  • GNU LGPL 2.1 for some older versions of some parts of the software
  • Public Domain (if explicitly stated. The .py scripts are public domain)
  • BSD 3-Clause where no other license applies (this readme)

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (1,126,504
C Plus Plus (367,743
C (274,195
Converter (1,924
Png (743
Webp (295
Related Projects