#!/bin/csh -f

set quality      = "-quality 30"
set subdirectory = "middle_size"
set conflag      = "-size 25%x25%"
set head         = "md"
switch($argv[1])
case '-q':
	set quality = "-quality $argv[2]"
	shift
breaksw;
case '-s':
	set subdirectory = "small_size"
	set conflag      = "-size 60x40"
	set head = "sm"
breaksw;
default:
case '-m':
	set subdirectory = "middle_size"
	set conflag      = "-size 25%x25%"
	set head = "md"
breaksw;
endsw

if ( ! -d $subdirectory ) then
	echo mkdir $subdirectory;
	mkdir $subdirectory;
endif

shift;

foreach i ( $* )
  if ( -f $i ) then
    echo convert $conflag $quality $i $subdirectory/$head\_$i;
    convert $conflag $i $subdirectory/$head\_$i;
  endif
end
