initial check-in
[blorb-thumbnailer.git] / scripts / mass-thumbnailer
blob9d7ead14145100402bf09f5bb69aad0fba211ad3
1 #!/bin/sh
3 # mass-thumbnailer: convenience script for testing many files at once
5 # Copyright 2011 Lewis Gentry.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 canonical=./blorb-thumbnailer
21 program_name=$canonical
23 while getopts s:c: flag; do
24 case $flag in
25 s) size=$OPTARG;;
26 c) program_name=$OPTARG;;
27 esac
28 done
29 shift $(($OPTIND - 1))
31 if [ $# = 0 ]; then
32 echo "Test thumbnailer against arguments and report exit status."
33 echo "Resulting thumbnails are written to the current directory."
34 echo "Example: sh $0 corpus/*.?blorb"
35 echo "General usage: $0 [options] [files]"
36 echo "Options: -c path/to/alternate-thumbnailer [default $canonical]"
37 echo " -s 120 [thumbnail size in pixels square]"
38 exit
41 if [ $program_name = $canonical ] && [ ! -e $canonical ]; then
42 echo $canonical not found.
43 exit
46 for pathname in "$@"; do
47 basename=`basename "$pathname"`
48 "$program_name" "$pathname" "$basename.png" $size > /dev/null
49 echo -e $? "\t" $pathname
50 done