title: How to convert dtype(uint16) data into a 16bit png image?
body: <p>I'm trying to encrypt and decrypt an image using RSA algo. For that, I need to read the image as greyscale and then apply the keys and save the uint16 type array into a png or any image format which supports 16bit data. Then I need to read that 16bit data convert it into an array and do the decryption. Now, previously I tried to save the image as .tif and when I read it with </p>
  
  <pre><code>img = sk.imread('image.tiff', plugin = 'tifffile')
  </code></pre>
  
  <p>it treats the image as RGB, which is not what I want. Now I want to save the uint16 type array to a 16bit png image which will take values between 0 to 65536 and then read it again as a uint16 type data. I tried to save the values to a 16bit png file using </p>
  
  <pre><code>img16 = img.astype(np.uint16)
  imgOut = Image.fromarray(img16)
  imgOut.save('en.png')
  </code></pre>
  
  <p>This gives me this error: <code>OSError: cannot write mode I;16 as PNG</code></p>
  
  <p>I have also tried <code>imgOut = Image.fromarray(img16, 'I')</code> but this yeilds <code>not enough image data</code></p>
  
  <p>Please help me to save the 16bit data into a .png image. Thank you. </p>