imagemagick - 如何在不改变速度的情况下改变 gif 的延迟
问题描述
出于愚蠢的时间原因,我需要一个延迟为 6 的 gif。唉,我的材料是延迟 20。
我实际上需要的是将延迟降低到 6,同时将每帧乘以三到四次。我不介意时间有点不对。
这似乎是一个足够简单的问题,但完全无法解决。
解决方案
你可以这样做:
#!/bin/bash
# Split animation into constituent frames, saving as "frame-nnn.gif"
convert animated.gif -coalesce frame-%03d.gif
# Make array of all framenames
frames=( frame-*gif )
# Triplicate array elements
for ((i=0;i<${#frames[@]};i++)); do newframes+="${frames[i]} ${frames[i]} ${frames[i]} "; done
# DEBUG echo ${newframes[@]}
# Rebuild animation with new speed
convert -delay 10 ${newframes[@]} new.gif
# Clean up
rm frame-*.gif 2> /dev/null
我的脚本假定您的原件被调用animated.gif
,结果将被调用new.gif
。显然,您可以根据需要更改延迟和重复次数,我选择的值是说明性的。
推荐阅读
- javascript - DataTables 表上的标题会折叠,直到发生某种重绘。有没有办法强制重新绘制标题或类似的东西?
- google-cloud-platform - 创建基于发布/订阅拉订阅的警报策略
- ruby-on-rails - Rails application.js:需要给定目录中的所有 js 文件
- python - 如何绘制图表以查看准确性
- javascript - 在 React-Redux 中计算总价格
- variables - 如何使用 Newman cli Companion 将 Azure DevOps 变量传递给 Postman 值?
- r - 错误“维数不正确” - 预测 tslm
- python - 为什么这个代码在函数执行后需要这么长时间?
- r - 修复 tex2image 图形中的字体大小
- python - Python Pandas:如何在多个周期中获得每个峰值的最大值