Skip to content

Instantly share code, notes, and snippets.

@jrialland
Created October 2, 2015 12:16
Show Gist options
  • Save jrialland/e5dddbf99e0ef62d47a7 to your computer and use it in GitHub Desktop.
Save jrialland/e5dddbf99e0ef62d47a7 to your computer and use it in GitHub Desktop.
Converts the successive outputs of a program into a splendid animated gif
#!/bin/bash
start=$1
end=$2
command=$3
outputfile=$4
delay=10
rm -rf /tmp/outputToGif 2>/dev/null
mkdir -p /tmp/outputToGif
for i in $(seq $start $end); do
echo $i/$end
$command $i | convert -background white -fill black -font courier label:@- /tmp/outputToGif/tmp$(printf "%08d\n" $i).gif
done
convert -layers Optimize -delay $delay -loop 0 /tmp/outputToGif/tmp*.gif $outputfile
rm -rf /tmp/outputToGif 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment