if [[ -n "${1}" ]]; then
  if (ls |grep -q .gif); then
    rm *.png
    string="-fuzz ${1}%"
  else
    echo "unable to find png file, exiting"
    exit
  fi
fi 
convert *.gif ${string} -coalesce -layers RemoveDups %d.png
rename 's/\d+/sprintf("%05d",$&)/e' *.png
