A PIL Question

Terry Hancock hancock at anansispaceworks.com
Sun Aug 14 20:42:02 CEST 2005


On Sunday 14 August 2005 12:34 pm, Ray wrote:
> import Image
> 
> im = Image.open("something.jpg")
> seq = im.getdata()
> 
> image = Image.Image()
> image.putdata(seq)
> 
> image.show()
> 
> I always get:
> 
> Traceback (most recent call last):
>   File "Script1.py", line 31, in ?
>     image.putdata(seq)
>   File "D:\Development\Python24\Lib\site-packages\PIL\Image.py", line
> 1120, in putdata
>     self.im.putdata(data, scale, offset)
> AttributeError: 'NoneType' object has no attribute 'putdata'
> 
> Anybody has any idea why this is the case? 

Well, obviously you didn't get an image back from Image.Image().
In fact, I suspect you would've at least have to have given it a size
or something.  It clearly returned None, and you're trying to call
a method that None doesn't have, like it says.

Definitely check the PIL manual for what Image.Image() is
supposed to return, and what it requires to have valid output.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list