gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 04:37:07 26 4
gpt4 key购买 nike

是否可以使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com