#! /bin/tcsh -fe
# Last edited on 2009-07-15 18:54:45 by stolfilocal

set usage = "$0 [ PPMFILE ] > EPSFILE.eps"

# Converts a PPM image to B/W eps file, with Floyd-Steinberg dithering
# (Does not use the printer screen). For good results, the EPS file
# should be printed unscaled on a 300 dpi printer, and will show 150
# original pixels per inch. For a 600 dpi printer, the EPS file should
# be scaled by 0.5.

if ( $#argv > 1 ) then
  echo "usage: ${usage}"
  exit 1
endif

cat $* \
  | ppmtopgm \
  | pnmscale 2 \
  | pgmnorm \
  | pgmtopbm -floyd \
  | pnmtopsx -scale 0.5 -noturn
