Post-processing PGPLOT postscript output
Intro
The PGPLOT package can produce high quality postscript output. The output files are, however, not compressed and so can be quite large and in particular pose problems when making submission to on-line article archives such as ArXiv.
The output files can usually be drastically compressed by making use of the facilities already build in to the newer versions postscript language. I've found that the following sequence of post-processing operations produces identical output and often much smaller files:
- Normalisation of the original postscript figure using the
"eps2eps" utility:
eps2eps infile.eps interfile1
- Compression using the encode.ps
utility script ( as a text
file). This script converts the postscript to internally
compressed postscript representation. Invoke as:
gs -q -dLEVEL3 -dASCII -- encode.ps interfile1 interfile2 -
Recreation of the bounding box using the "ps2eps" utility:
cat interfile2 | ps2eps -f -O -B -E > finalfile.eps
Above infile.eps is the postcript figure as produced by PGPLOT, interfile1 and interfile2 are intermediate files and finalfile.eps is the final compressed encapsulated postscript figure.
gs -q -dLEVEL3 -dASCII -- encode.ps interfile1 interfile2
cat interfile2 | ps2eps -f -O -B -E > finalfile.eps