#! /bin/csh -f

set noclobber
foreach f ( `cd ppm-400x400/ && ls *.ppm | sed -e 's:[.]ppm::g'` )
  echo $f
  cat ppm-400x400/$f.ppm | pnmscale -xsize 256 | ppmtopgm | pgmnorm -bpercent 0 -wpercent 2 | pnmdepth 255 > pgm-256x256-tmp/$f.pgm
  cat ppm-400x400/$f.ppm | pnmscale -xsize 128 | ppmtopgm | pgmnorm -bpercent 0 -wpercent 2 | pnmdepth 255 > pgm-128x128-tmp/$f.pgm
end
