# Alter FINDHERE to where you want this thing to search FINDHERE="/home/pi/public_html/" # Identify will give multiple lines for animated gif. function is_animated_gif() { FRAMES=$(identify $1 | wc -l) [ $FRAMES -eq 1 ] && return 1 [ $FRAMES -ge 1 ] && return 0 } #Clean up rm animated_gif_report.txt non_animated_report.txt ### Save the field separators. The files I generate are newline sep'd old_IFS=$IFS IFS=" " #Make a report of all the found .gifs for i in `find $FINDHERE -iname '*.gif'` ; do if is_animated_gif $i ; then echo $i >> animated_gif_report.txt else echo $i >> non_animated_report.txt fi done for GIFFILE in `cat non_animated_report.txt` ; do PNGFILE=`echo $GIFFILE | sed 's/\.gif/.png/i'` echo convert $GIFFILE $PNGFILE # for debugging # convert $GIFFILE $PNGFILE # Uncomment if you're certain. done #fix the field separator IFS=$old_IFS