有没有一种简单的方法将32位.tif转换为16位.tif?在IDL中,write_tiff允许使用/short而不是/float。Python可以做到吗?相反,我尝试了以下方法:
i32 = Image.open('image.tif')
<Image.Image image mode=F size=2016x2016 at 0x102A3E998>
i32.convert('L').save('newimage.tif')
ImageJ(图像查看器)打开tif文件并指出该图像是8位而不是16位。
a = numpy.asarray(i32); matplotlib.pyplot.imshow(a)
。 - heltonbiker