Skip to content

Instantly share code, notes, and snippets.

@wtbarnes
Last active March 8, 2016 19:23
Show Gist options
  • Save wtbarnes/1fdb7e066e762a50ced9 to your computer and use it in GitHub Desktop.
Save wtbarnes/1fdb7e066e762a50ced9 to your computer and use it in GitHub Desktop.
shell script that uses ImageMagick utility to easily create GIFs from multiple files
#!/bin/bash
#Script to use ImageMagick to batch convert images to gif
#set command line parameters
species=$1
alpha=$2
loop_length=$3
tpulse=$4
f_ext=$5
f_out=$6
f_ext2="ebtel_L${loop_length}_tpulse${tpulse}_alpha${alpha}_${species}_heating_em_mc"
#set convert parameters
REPEAT=0 #set to zero for infinitely repeating loop
DELTA=40 #amount of separation between frames in a hundredth of a second
#set first part of string
s1="ebtel_L${loop_length}_tpulse${tpulse}_alpha${alpha}_${species}_heating_tn"
s2="_em.pdf"
ext=".gif"
sep="/"
#Run ImageMagick convert
convert -delay $DELTA -loop $REPEAT $(for ((tn=250;tn<=5000;tn=tn+250)); do echo $f_ext$f_ext2$sep$s1$tn$s2; done) $f_out$ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment