javascript - 将 PNG 图像连接到 APNG 动画图像

标签 javascript node.js apng

是否可以使用 nodejs 以某种方式将 PNG 图像连接到 APNG 动画图像?

我只找到了 PHP 库:link

最佳答案

UPNG.js 可以解析和构建 APNG 文件 - https://github.com/photopea/UPNG.js

来自自述文件 -

UPNG.js supports APNG and the interface expects "frames".

UPNG.encode(imgs, w, h, cnum, [dels])

imgs: array of frames. A frame is an ArrayBuffer containing the pixel 
      data (RGBA, 8 bits per channel)
w, 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

UPNG.js can do a lossy minification of PNG files, similar to TinyPNG and other tools. It performs color quantization using the k-means algorithm.

Lossy compression is allowed by the last parameter cnum. Set it to zero for a lossless compression, or write the number of allowed colors in the image. Smaller values produce smaller files. Or just use 0 for lossless / 256 for lossy.

关于javascript - 将 PNG 图像连接到 APNG 动画图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18297616/

相关文章:

javascript - ElasticSearch JavaScript promise

JavaScript 和 CSS : How to log position of a div between css translate start and end

javascript - onclick 按钮不调用函数

node.js - 将函数传递给其他原型(prototype)

node.js - Twilio Whatsapp : Sending Multiple Media Messages

c# - 实现 APNG 渲染函数

python - 在 Python 中读取动画 PNG?

ffmpeg - 使用 ffmpeg 创建循环 apng

javascript - JQTOUCH,绑定(bind)到通过 AJAX 拉入的链接,进行另一个 AJAX 调用?可能的?

node.js - 错误代码 : 800A1391 Source: Microsoft JScript runtime error Running Grunt - Module is undefined