如何在不改变速度的情况下改变 gif 中的延迟
How to alter delay in a gif, without altering its speed
出于愚蠢的时间原因,我需要一个延迟 6 的 gif。唉,我的 material 是延迟 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
。显然,您可以根据需要更改延迟和重复次数,我选择的值是说明性的。
出于愚蠢的时间原因,我需要一个延迟 6 的 gif。唉,我的 material 是延迟 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
。显然,您可以根据需要更改延迟和重复次数,我选择的值是说明性的。