[Image-SIG] PIL 1.0b1 can't read PCX files

Fredrik Lundh fredrik@pythonware.com
Thu, 4 Feb 1999 20:36:55 +0100


Bernhard Herzog wrote:
>PIL 1.0b1 can't read PCX files. This is the traceback:
>
/.../
>  File "/usr/local/lib/python1.5/site-packages/PIL/Image.py", line 225, in _getdecoder
>    return apply(decoder, (mode,) + args + extra)
>ValueError: unknown raw mode

quick fix: in PcxImagePlugin.py:

            if ord(s[0]) == 12:
                self.palette = ImagePalette.raw("RGB", s[1:])
                self.mode = "P"

becomes

            if ord(s[0]) == 12:
                self.palette = ImagePalette.raw("RGB", s[1:])
                self.mode = rawmode = "P"

Cheers /F
fredrik@pythonware.com
http://www.pythonware.com