Python and 16 Bit Tiff

后端 未结 4 499
遇见更好的自我
遇见更好的自我 2020-12-05 08:24

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

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 08:54

    You appear to have stumbled into a PIL bug, or a corner case that was unimplemented.

    Here's a workaround:

    i16.mode = 'I'
    i16.point(lambda i:i*(1./256)).convert('L').save('foo.png')
    

提交回复
热议问题