PIL(低)和多页TIFFS

ant*_*ony 7 python tiff python-imaging-library

这应该相对容易,但是谁知道......

有没有办法使用PIL/Pillow检索多页TIFF文件中的帧数,而不会迭代整个堆栈直到seek引发错误?

j6m*_*6m8 8

尝试使用n_frames:

from PIL import Image

tiffstack = Image.open('my_img.tiff')
tiffstack.load()

print(tiffstack.n_frames)
Run Code Online (Sandbox Code Playgroud)

  • 好吧,我把它自己打扮成枕头(https://github.com/python-pillow/Pillow/pull/1195)但是肯定的,我会接受答案:) (6认同)