Python and 16 Bit Tiff
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How can I convert and save a 16 bit single-channel TIF in Python? I can load a 16 and 32 bit image without an issue, and see that the 32 bit image is mode F and the 16 bit image is mode I;16S : import Image i32 = Image . open ( '32.tif' ) i16 = Image . open ( '16.tif' ) i32 # i16 # But I am having trouble working with the 16 bit image. If I want to save either as PNG, I cannot do so directly: i32 . save ( 'foo.png' ) # IOError: cannot write mode F as PNG i16 . save ( 'foo.png' ) # ValueError: unrecognized mode If I convert the 32