Is there any way to save a numpy array as a 16 bit image (tif, png) using any of the commonly available python packages? This is the only way that I could get to work in the
This explanation of png and numpngw is very helpful! But, there is one small "mistake" I thought I should mention. In the conversion to 16 bit unsigned integers, the y.max() should have been y.min(). For the picture of random colors, it didn't really matter but for a real picture, we need to do it right. Here's the corrected line of code...
z = (65535*((y - y.min())/y.ptp())).astype(np.uint16)