[Image-SIG] Re: PCX
Fredrik Lundh
fredrik at pythonware.com
Tue Aug 3 19:18:01 CEST 2004
Greg Hamilton wrote:
> I have a PCX image which I can't manipulate with PIL.
>
> The image loads without error. PIL identifies it as a mode '1' PCX file
> and reads the image size correctly. Unfortunately the image content is
> lost, I just get a black rectangle.
turns out that the tile member isn't properly set up for images where
the PCX xmin or xmax headers are non-zero. here's a patch:
Index: PIL/PcxImagePlugin.py
===================================================================
--- PIL/PcxImagePlugin.py (revision 1939)
+++ PIL/PcxImagePlugin.py (working copy)
@@ -96,6 +96,8 @@
self.mode = mode
self.size = bbox[2]-bbox[0], bbox[3]-bbox[1]
+ bbox = (0, 0) + self.size
+
self.tile = [("pcx", bbox, self.fp.tell(), (rawmode, planes * stride))]
# --------------------------------------------------------------------
More information about the Image-SIG
mailing list