无法打开 .tif 图像

Fel*_*ier 0 python tiff type-conversion

我想打开 .tif 图像,但我尝试使用的每个库总是出现错误。我尝试使用 PIL:

from PIL import Image
img = Image.open('filepath/img_name.tif')
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

UnidentifiedImageError:无法识别图像文件“filepath/img_name.tif”

(这个错误并不意味着我找不到该文件,所以目录应该是好的)

我尝试使用 tifffile:

import tifffile
img = tifffile.imread('filepath/img_name.tif')
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

NotImplementedError:不支持将 14 位整数解包为 uint16。

我很确定问题是图片,因为我尝试在互联网上打开一个 tif 图像,它只需这样做即可工作:这就是图片

from PIL import Image
im = Image.open('a_image.tif')
Run Code Online (Sandbox Code Playgroud)

有没有办法将 14 位图片转换为 16 位图片?(我知道我可以乘以 4 得到 16 位,但我不知道如何)

Fel*_*ier 5

我安装了imagedecodecs并且tifffile已经能够打开它

import tifffile
img = tifffile.imread(tif_name)
Run Code Online (Sandbox Code Playgroud)

问题是我的图像是 14 位的。