[Image-SIG] PIL & FH10 eps files

abel deuring a.deuring@satzbau-gmbh.de
Fri, 19 Jul 2002 12:04:28 +0200


Bernhard Herzog wrote:
> 
> abel deuring <a.deuring@satzbau-gmbh.de> writes:
> 
> > hi all,
> >
> > it seems that PIL.EpsImagePlugin (version 1.1.3) does not like the
> > headers from EPS files produced by Freehand 10: (1) FH10 writes an empty
> > line after the leading "%!PS-Adobe-2.0 EPSF-1.2", and (2) the line
> > "%ALDOriginalFile:..." raises the exception IOError, "bad EPS header".
> > Neither the regex "split" nor the regex "field" recognize this line.
> > Attached is a fix and an example for FH10 EPS header.
> >
> > Abel%!PS-Adobe-2.0 EPSF-1.2
> >
> > %%Title: Unbenannt-1
> 
> That empty line is part of the output? In that case the EPS file is not

yes, it is. At least the Mac version of FH 10 writes such a header.

> really an EPS file because the header doesn't contain the required (for
> EPS) BoundingBox DSC comment (quoting from the DSC specification):
> 
>     Because header comments are contiguous, any line that does not begin
>     with %X where X is any printable character except space, tab, or
>     newline implicitly denotes the end of the header section.
> 
>     %!PS-Adobe-3.0
>     %%Title: (Example of Header Comment Termination)
>     ...More header comments...
>     %%DocumentResources: font Sonata
>     %GBDNodeName: smith@atlas.com
>     % This line implicitly denotes the end of the header section.

Bernhard,

you're right. Personally, I would prefer to throw them away, but
unfortunately I have to deal with them... So it's perhaps better to
write a small filter that fixes the bugs.

Abel