#!/usr/bin/tcsh -f

# History :
#
# 07.08.2002 (yk) created (karal@kogs1.informatik.uni-hamburg.de)
# 08.08.2000 (ut) usage added (utcke@informatik.uni-hamburg.de)

if ( "$#" != "3") then
  echo ""
  echo "usage :"
  echo ""
  #  echo "  module add imagemagick (once)"
  echo "  convert.sh MyMovie d tiff"
  echo ""
  echo 'will convert "MyMovied.raw" into some "MyMoviexxxxd.tiff" images'
  echo 'where "xxxx" runs from "aaaa" to "zzzz"'
  echo ""
  exit 1
endif

module add imagemagick

set file = $argv[1]$argv[2]
echo "working on $file.raw"
split -b 779k -a 4 $file.raw $file
rm $file.raw
foreach i ($file*)
  echo $i
  convert -depth 8 -size 1024x779 gray:$i $i.$argv[3]
  rm -f $i
end

/home/utcke/bin/mmv "$file*.$argv[3]" "$argv[1]*$argv[2].$argv[3]"

