First you should make your array 50x50 instead of a 1d array:
my_array = my_array.reshape((50, 50))
Then, to get a standard 8bit image, you should use an unsigned 8-bit integer dtype:
my_array = my_array.reshape((50, 50)).astype('uint8')
But you don't want the True
s to be 1
, you want them to be 255
:
my_array = my_array.reshape((50, 50)).astype('uint8')*255
Finally, you can convert to a PIL image:
im = Image.fromarray(my_array)
I'd do it all at once like this:
im = Image.fromarray(my_array.reshape((50,50)).astype('uint8')*255)