多页 TIFF 中有多少页?

How many pages in a multi-page TIFF?

在python中,如何计算多页TIFF中pages/frames的数量?

Pillow,PIL 的分支,应该适用于 TIFF (http://pillow.readthedocs.io/en/3.1.x/handbook/image-file-formats.html#tiff)

一种实现您想要的方法是打印特定变量 n_frames :

from PIL import Image

try:
    img = Image.open('multipage_tiff_example.tif')
    img.load()
    print(img.n_frames)
except:
    print("Unable to load image")