#!/bin/bash
# This script will create a thumbs/ directory containing thumbnails
# of all JPEG files in the current folder.

if [ ! -e thumbs ] ; then 
	mkdir thumbs || (echo HELP; exit)
	if [ $? -ne 0 ] ; then
		echo HELP
		exit
	fi
fi

for i in *.jpg *.jpeg *.JPG *.JPEG
do
	if [ ! -e $i ]
	then
		continue
	fi

	echo "Resizing $i"
	jpegtopnm < $i | pnmscale -xsize=200 | pnmtojpeg > thumbs/$i 2> /dev/null
done


