Python: Read and write TIFF 16 bit , three channel , colour images

后端 未结 6 2254
眼角桃花
眼角桃花 2020-12-07 14:32

Does anyone have a method for importing a 16 bit per channel, 3 channel TIFF image in Python?

I have yet to find a method which will preserve the 16 bit depth per ch

6条回答
  •  清歌不尽
    2020-12-07 15:33

    It has limited functionality, especially when it comes to writing back to disk non RGB images, but Christoph Gohlke's tifffile module reads in 3 channel 16-bit TIFFs with no problems, I just tested it:

    >>> import tifffile as tiff
    >>> a = tiff.imread('Untitled-1.tif')
    >>> a.shape
    (100L, 100L, 3L)
    >>> a.dtype
    dtype('uint16')
    

    And Photoshop reads without complaining what I get from doing:

    >>> tiff.imsave('new.tiff', a)
    

提交回复
热议问题