[Image-SIG] Re: suspected bug in PIL 1.1.3 bmp reader

Fredrik Lundh fredrik@pythonware.com
Tue, 22 Apr 2003 18:06:35 +0200


Jeff Breidenbach wrote:

> I have an uncompressed BMP file, that I believe to be valid, that PIL
> chokes on. I can call Image.open no problem, but PIL fails for any
> sort of operation beyond that. My Python/PIL installation works
> fine with other image files and my best guess is this is a
> bug. Any thoughts?

this might work: in PIL/BmpImagePlugin.py, change

    if greyscale:
        if colors == 2:
            self.mode = "1"
        else:
            self.mode = rawmode = "L"

to

    if greyscale:
        if colors == 2:
            self.mode = rawmode = "1" # <-- here!
        else:
            self.mode = rawmode = "L"

</F>