[Image-SIG] PIL & FH10 eps files
abel deuring
a.deuring@satzbau-gmbh.de
Thu, 18 Jul 2002 17:46:59 +0200
Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------DA863DCECDE60B2D26FDAE2B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
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
--------------DA863DCECDE60B2D26FDAE2B
Content-Type: text/plain; charset=us-ascii;
name="fh10.eps-header"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="fh10.eps-header"
%!PS-Adobe-2.0 EPSF-1.2
%%Title: Unbenannt-1
%%Creator: FreeHand 10.0
%%CreationDate: 18.07.2002 16:58 Uhr
%%BoundingBox: 0 0 46 28
%%FHPathName:Gans auf Daten eingestellt:Programme:FreeHand 10:German:Unbenannt-1
%ALDOriginalFile:Gans auf Daten eingestellt:Programme:FreeHand 10:German:Unbenannt-1
%ALDBoundingBox: -34 -778 561 63
%%FHPageNum:1
%%DocumentSuppliedResources: procset Altsys_header 4 0
%%ColorUsage: Color
%%DocumentProcessColors: Black
%%PlateFile: (Black) EPS #98739 100041
%%EndComments
--------------DA863DCECDE60B2D26FDAE2B
Content-Type: text/plain; charset=us-ascii;
name="EpsImagePlugin.py.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="EpsImagePlugin.py.diff"
--- EpsImagePlugin.py.orig Sun Mar 10 17:57:39 2002
+++ EpsImagePlugin.py Thu Jul 18 17:16:38 2002
@@ -33,7 +33,7 @@
def o32(i):
return chr(i&255) + chr(i>>8&255) + chr(i>>16&255) + chr(i>>24&255)
-split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$")
+split = re.compile(r"^%[%!\w]([^:]*):[ \t]*(.*)[ \t]*$")
field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$")
def Ghostscript(tile, size, fp):
@@ -202,6 +202,10 @@
raise IOError, "bad EPS header"
s = fp.readline()
+ # at leat eps files produced by Freehand 10 may contain empty lines
+ # in the header:
+ while len(s) == 1:
+ s = fp.readline()
if s[:1] != "%":
break
--------------DA863DCECDE60B2D26FDAE2B--