[Image-SIG] Error when trying to open a .ps file

Fredrik Lundh fredrik at pythonware.com
Sat May 28 13:23:27 CEST 2005

"Ertl, John" wrote:

> I am trying to open a .ps file and then eventually convert it to a .png but
> I cannot even open it.   If I use a postscript viewer I can view the image
> so I think the image is O.K.  I am using Python 2.4 on RH ES 3.0 and PIL
> 1.1.5.  I have been doing some work with other formats it has been great so
> I think PIL is installed correctly but I have just had no luck with .ps
> files.
> Any ideas?
> >>> im = Image.open("test.ps")
> Traceback (most recent call last):
>   File "<pyshell#2>", line 1, in -toplevel-
>     im = Image.open("test.ps")
>   File
> "/opt/global/python/python-2.4/lib/python2.4/site-packages/PIL/Image.py",
> line 1730, in open
>     return factory(fp, filename)
>   File
> "/opt/global/python/python-2.4/lib/python2.4/site-packages/PIL/ImageFile.py"
> , line 82, in __init__
>     self._open()
>   File
> "/opt/global/python/python-2.4/lib/python2.4/site-packages/PIL/EpsImagePlugi
> n.py", line 277, in _open
>     raise IOError, "cannot determine EPS bounding box"
> IOError: cannot determine EPS bounding box

PIL can only open EPS files (a variant of PS designed for embedding),
and it looks like your PS file isn't an EPS.

I suggest running it directly through Ghostscript (in batch mode), and
processing the output instead.


More information about the Image-SIG mailing list