Skip to content

Instantly share code, notes, and snippets.

@walfie
Created April 1, 2018 02:40
Show Gist options
  • Save walfie/253e8ea16293cae59a72ef85aef749e0 to your computer and use it in GitHub Desktop.
Save walfie/253e8ea16293cae59a72ef85aef749e0 to your computer and use it in GitHub Desktop.
gif from png sequence for twitter
# Let's say an animation has frames {1,2,3,4}.png and is 24fps.
# To make it loop nicely on twitter, we want something like:
#
# 1 1 2 2 3 3 4
#
# at 48fps. The below command, using a bunch of hacks, will
# take a PNG sequence and create a gif with the above sequence.
# Note that 2.0833333... is 1/48, e.g., 48fps.
convert -limit thread 1 -delay 2.0833333333 $(echo *.png *.png | sed 's/ /\n/g' | sort | head -n $(( $(ls -l *.png *.png | wc -l) - 1 )) ) out.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment