#!/bin/bash extract_gif_to_png() { local bname="$(basename $1)" local dname="${bname%.*}" if [ -d "$dname" ]; then echo "directory ($dname) already exists..." return fi mkdir -p "$dname" convert -coalesce "$bname" "${dname}/%03d.png" } extract_gif_to_png "$1"