Address boundary error when trying to use Image.putdata(array) from PIL

MRAB python at mrabarnett.plus.com
Sat Sep 24 18:32:28 EDT 2016


On 2016-09-24 11:59, Tristan Trouwen wrote:
> Got a signal boundary error.
>
> Steps to reproduce:
> open python console
>
> Python 2.7.9 (default, Jun 29 2016, 13:08:31)
> [GCC 4.9.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from PIL import Image
>>>> im = Image.open('HKJL.jpg')
>>>> import numpy as np
>>>> arr = np.array(im)
>>>> arr[arr < 10] = 0
>>>> im.putdata(arr)
> fish: “python” terminated by signal SIGSEGV (Address boundary error)
>
> The image I used: http://i.imgur.com/hnuzhFj.jpg
>
That looks like a bug.

I'm on Python 3.5 on Windows and I get an exception:

     SystemError: new style getargs format but argument is not a tuple

 From what I've been able to find out, the argument of 'putdata' should 
be a list (sequence) of tuples.

A quicker way is to create a new image from the array:

     im = Image.fromarray(arr)




More information about the Python-list mailing list