[Image-SIG] Image.putdata, Python crash

Fredrik Lundh fredrik at pythonware.com
Fri Jun 16 08:50:19 CEST 2006

Rune Strand wrote:

> Because of my lousy code/PIL newbieness or something completely 
> different, Windows Python 2.4.3 crashes (in _imaging.pyd) after a call 
> to  Image.putdata(a_list_of_ints).

after some digging, this appears to be a bug in how putdata behaves on 
memory-mapped images.  the simplest way to work around this is to do:

     img = Image.open(bmp_file)

     img = img.copy() # make sure we have a writable copy

if you want to be a bit more careful, you can do:

     # make sure putdata can write to the image memory
     if img.readonly:
         img = img.copy()


hope this helps!


More information about the Image-SIG mailing list