PIL(low) and multi-page TIFFS

核能气质少年 提交于 2019-11-26 22:02:58

问题


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

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?


回答1:


Try using n_frames:

from PIL import Image

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

print(tiffstack.n_frames)


来源:https://stackoverflow.com/questions/26660415/pillow-and-multi-page-tiffs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!