A small, fast and advanced PNG / APNG encoder and decoder. It is the main PNG engine for Photopea image editor.
Download and include the
UPNG.js file in your code, or get it from NPM:
UPNG.js supports APNG and the interface expects "frames". Regular PNG is just a single-frame animation (single-item array).
... read the whole story at github.com.
imgs: array of frames. A frame is an ArrayBuffer containing the pixel data (RGBA, 8 bits per channel)
h : width and height of the image
cnum: number of colors in the result; 0: all colors (lossless PNG)
dels: array of delays for each frame (only when 2 or more frames)
- returns an ArrayBuffer with binary data of a PNG file