[Image-SIG] Image.point breakage in PIL 1.1.5?

David Rushby davidrushby at yahoo.com
Tue Jan 24 01:21:00 CET 2006


I have some code that uses the Image.point() method to filter pixels in
black-and-white images.

I'm using Python 2.3.5 on Windows 2000, and when I tried to upgrade
from PIL 1.1.4 to 1.1.5, the code stopped working.  Now it raises an
error like this:
------------------------------------------------------------------------
Traceback (most recent call last):
  File "test2.py", line 4, in ?
    i2 = i1.point(lambda p: (p > 20 and p) or 0)
  File "C:\dev\python\core\Lib\site-packages\PIL\Image.py", line 1039,
in point
    lut = map(lut, range(256)) * self.im.bands
AttributeError: 'NoneType' object has no attribute 'bands'
------------------------------------------------------------------------

If you take the image file at
http://kinterbasdb.sourceforge.net/other/temp/test2.bmp and apply the
following code to it, you'll see the error:
------------------------------------------------------------------------
from PIL import Image
i1 = Image.open('test2.bmp')
i2 = i1.point(lambda p: (p > 20 and p) or 0)
------------------------------------------------------------------------

This works fine with PIL 1.1.4, but not 1.1.5.  Is my code in error, or
is there a bug in PIL 1.1.5?

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Image-SIG mailing list