#!/bin/sh  
# \
exec oagtclsh "$0" "$@"

set auto_path [linsert $auto_path 0  /usr/local/oag/apps/lib/$env(HOST_ARCH)]
set auto_path [linsert $auto_path 0 /usr/local/oag/lib_patch/$env(HOST_ARCH)]
APSStandardSetup

set usage {usage: eps2whatever [-xsize <pixels(1024)>]  -input <filename> -output <filename> }
set xsize 1024
set input ""
set output ""
set args $argv
if {[APSStrictParseArguments {xsize input output}] || ![string length $input] || ![string length $output]} {
    return -code error "$usage"
}
if ![file exists $input] {
    return -code error "not found: $input"
}
if [string compare $input $output]==0 {
    return -code error "eps2whatever: input and output are identical"
}

catch {exec pstopnm -xsize=$xsize $input -stdout \
        | convert - -trim -quality 100 $output}
