本文介绍了PIL(低)和多页TIFFS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这应该比较容易,但是谁知道...

This should be relatively easy, but who knows...

是否有一种方法可以使用PIL/Pillow检索多页TIFF文件中的帧数,而无需遍历整个堆栈,直到seek引发错误?

Is there a way to retrieve the number of frames in a multi-page TIFF file using PIL/Pillow, without iterating through the whole stack until seek raises an error?

推荐答案

尝试使用n_frames:

from PIL import Image

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

print(tiffstack.n_frames)

这篇关于PIL(低)和多页TIFFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 16:47