#!/bin/sh # Some EPS files have broken bounding boxes. epstool will happily (via gs) # calculate a new bounding box for us. The new bounding box is determined by # the minimum extents of a) the draws objects and b) the paper boundary (by # default letter). # This script arranges to fix the bounding box in-place for the given file, # choosing a new bounding box determined only by drawn objects. The # -sPAPERSIZE=a0 is hackery to avoid paper size being an issue (A0 is pretty # big paper). # Copyright (c) 2007 by Reid Priedhorsky, . # # This script is distributed under the terms of the GNU General Public # License; see http://www.gnu.org/licenses/gpl.txt for more information. set -e if [ -z $1 ]; then echo "Usage: $0 EPS_FILE" exit 1 fi tmpfile=/tmp/epsfixbbox.eps.$$ cp -v $1 $tmpfile epstool --copy --bbox --gs-args "-sPAPERSIZE=a0" $tmpfile $1 rm -f $tmpfile