title: Python: Read and write TIFF 16 bit , three channel , colour images
body: <p>Does anyone have a method for importing a 16 bit per channel, 3 channel TIFF image in Python?</p>
  
  <p>I have yet to find a method which will preserve the 16 bit depth per channel when dealing with the TIFF format. I am hoping that some helpful soul will have a solution.</p>
  
  <p>Here is a list of what I have tried so far without success and the results:</p>
  
  <pre><code>import numpy as np
  import PIL.Image as Image
  import libtiff
  import cv2
  
  im = Image.open('a.tif')
  # IOError: cannot identify image file
  
  tif = libtiff.TIFF.open('a.tif')
  im = tif.read_image()
  # im only contains one of the three channels. im.dtype is uint16 as desired.
  im = []
  for i in tif.iter_images():
      # still only returns one channel
  
  im = np.array(cv2.imread('a.tif'))
  # im.dtype is uint8 and not uint16 as desired.
  # specifying dtype as uint16 does not correct this
  </code></pre>
  
  <p>So far the only solution I have found is to convert the image to PNG with ImageMagick. Then the bog standard <code>matplotlib.pyplot.imread</code> reads the PNG file without any problems. </p>
  
  <p>Another problem I have is saving any numpy arrays as 16 bit PNG files which so far has not been straightforward either.</p>