I have a variable img which is a int64 numpy.array with sizes 28x28. Its content looks like this:
[...]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 68 154 188 176 254 254 254 254 254
227 106 17 0 0 0 0 0 0 0]
[...]
I want to convert the array to a PIL image. To do so I call img = Image.fromarray(img, mode='L') but the output I get is only 0s while it is obvious that it shouldn't be like that. I have checked the mode options and seems like L is correct. Also checked other answers inside stackoverflow and couldn't find something that reproduces this particular problem.
L (8-bit pixels, black and white)
Why is this "simple" piece of code given an unexpected behaviour?
Thanks in advance!
np.uint8?