I have a numpy.ndarray
of shape (1,28,28)
and values are floating point in range [0,1]. My ultimate goal is to save the array as a png image.
Even after transposing the array and multiplying it with 255 so as to get uint values, still, it throws the error *** TypeError: Cannot handle this data type: (1, 1, 1), |u1
.
I am using the following code:
im = Image.fromarray((img.transpose(1,2,0) * 255).astype(np.uint8))
Any help will be appreciated.
P.S. I already worked on the suggestion here.