方便修改动画 webp 的小工具

2019-08-17 14:48:31 +08:00
 deepkolos

AWebp

animated webp 小工具, 对 libwebp 的简单封装, 提供对 animated webp 相关的常用批处理功能(笨方法)

> npm i -g awebp
> awebp -h

  -h --help                                                      显示帮助
  -d --dispose [method] [file] [outFile]                         dispose-method: 0 for NONE or 1 for BACKGROUND
  -q --quality [quality] [file] [outFile]                        Specify the compression between 0 and 100
  -e --extract-frame [file] [outDir]                             提取所有帧出来
  -c --compose [frameDir] [outFile] [frameOpt] [loop] [bgColor]          从多个图片合成 animated webp, frameOpt 与 webpmux 一致
  -i --info [file]                                               统计 duration
  -f --fps [fps] [file] [outFile]                                修改 duration, fps 更好描述
  -l --loop [loop] [file] [outFile]                              修改 loop, 0 为无限循环
  -b --bg-color [bgColor] [file] [outFile]                       修改 webp 背景颜色, A,R,G,B

Examples:
  awebp -d 0 ./test/test.webp                                    // 设置 webp 每帧的 dispose method 为 0
  awebp -q 60 ./test/test.webp                                   // 设置动图 webp 压缩率, 提取帧->转 png->重新拼接 webp
  awebp -e ./test/test.webp frames                               // 提取所有帧出来到 frames 文件夹
  awebp -c frames out.webp +34+0+0+1+b 1 255,255,255,255         // 从 frames 文件夹合成 webp
  awebp -i ./test/test.webp                                      // 统计出 animated webp duration
  awebp -f 60 ./test/test.webp                                   // 修改 animated webp duration (60fps ~= 17)
  awebp -l 3 ./test/test.webp                                    // 修改 webp 的循环次数为 3 次
  awebp -b 0,0,0,0 ./test/test.webp                              // 修改 webp 背景颜色

使用场景

  1. ffmpeg 转换出来的 webp 重叠问题, 需要设置 dispose-method 为 BACKGROUND
  2. animated webp 压缩
2066 次点击
所在节点    分享创造
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/592701

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX