#!/bin/sh res=1200 margin=10 usage() { echo "usage: mkppmtext [-r res] [-m margin]" >&2 exit 1 } while getopts ":r:m:" c do case "$c" in r) res=$OPTARG;; m) margin=$OPTARG;; :|'?') usage;; esac done exec 2>/dev/null gs -q -dBATCH -dNOPAUSE -sDEVICE=pbmraw -r$res -sOutputFile=- -_ | \ pnmscale $(echo $res | nawk '{ print 85 / $0 }') | pnmcrop -white | \ pnmmargin -white $margin .