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