Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PIL(low) and multi-page TIFFS

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?

like image 254
antony Avatar asked Oct 30 '14 18:10

antony


Video Answer


1 Answers

Try using n_frames:

from PIL import Image

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

print(tiffstack.n_frames)
like image 181
j6m8 Avatar answered Sep 28 '22 20:09

j6m8