#! /bin/csh -f # # script for automatically grabbing a section of the SGI screen # and turning it into a numbered file on disk. # The output files will be called: frame0001.rgb, frame0002.rgb, etc. # # Incrementing the counter is automatic. Therefore, to reset the # counter you must: # rm frame????.rgb # # Alternately, you can specify a frame number on the command line. # # this is a good box for Insight set center = "700 550" set size = "640 480" # this box is good for O on the right side of the screen #set center = "795 492" #set size = "640 480" ############################################################### # now convert the center/size to a box set box = `echo "$center $size" | nawk '{printf "%d %d %d %d", $1-$3/2, $1+$3/2-1, $2-$4/2, $2+$4/2-1}'` # auto-increment file number set num = `ls -1 frame*.rgb |& tail -1 | nawk '{printf "%04d", substr($1,6)+1}'` # user-defined image number if("$1" =~ [1-9]*) set num = `echo "$1" | nawk '{printf "%04d", $1}'` # use "scrsave" to grab the screen echo -n "saving frame${num}.rgb " scrsave frame${num}.rgb $box echo "done" # rescale? label? convert the image with mogrify