After some mail exchange (thanks to the people who answered), I wrote a
python script "epscrop" that does the conversion. It requires Python >1.5 and
ps2epsi. It can be called from the command line with as many arguments as
wished, e.g. "cropeps *.eps" and will convert all files in turn.
The conversion is done using ps2epsi. It does _not_ render text in
illustrations to bitmaps, unlike gs. On the other hand, it adds a bitmap
preview to the eps file. This preview is then stripped again.
A bit of a kludge, but it works here. If anybody else can use it, here goes:
file epscrop:
----------------------------------------------------------------
#!/usr/bin/python
from sys import argv
from os import system
from string import replace
import re
matchstr = re.compile(r"%%BeginPreview.*%%EndPreview", re.DOTALL)
# A regular expression matching a bitmap preview in epsi files
def strip_preview(filename):
file = open(filename, 'r')
text = file.read() # read eps file
file.close()
newtext = matchstr.sub("", text) # replace preview by ""
file = open(filename, 'w')
file.write(newtext) # write back new file
file.close()
for infile in argv[1:]: # loop through arguments
outfile = replace(infile, ".eps", "[cr].eps")
print "Converting " + infile + " to " + outfile
system("ps2epsi " + infile + " " + outfile)
strip_preview(outfile)
---------------------------------------------------------------
Cheers
Kaspar
--
Kaspar Pflugshaupt
Geobotanical Institute
ETH Zurich, Switzerland