[Image-SIG] PIL: stepping through multi-page tiff files

Kevin Cazabon KCAZA@cymbolic.com
Thu, 20 May 1999 15:44:44 -0700

Just a shot in the dark, but isn't the seek() command ADDITIVE?

as in:

im.seek(1) (would bring you to the second image)
im.seek(1) (for the third image...)

>>> Randy Trigg <trigg@parc.xerox.com> 05/20/99 03:20PM >>>
Has anyone had any trouble with the PIL support for multi-page tiffs?  I
have a 9-page tiff file (packbits compression) which I open in PIL, as

  im = Image.open(foo.tif)

Then I call im.seek(1), im.seek(2), ..., im.seek(9).  I only get four
steps of this before it dies with "Missing TIFF directories."  Looking
at the frames it generates, I can see that successive seeks skip frames,
that is, seek(1) gives me page 3, seek(2) gives page 5, seek(3) gives
page 7, and seek(4) gives page 9 (thus the error after the fourth seek).

I've tried some variations like seek(0), seek(1), seek(0), seek(2),
seek(0), seek(3), etc.  That gives me more of the pages, 7 or 8, but
with one of the pages repeated.  But no variation gives me all of the

I tried to do this with an uncompressed version of the tiff file, but
still no luck.  By the way, the tiff file is fine - all 9 pages are
viewable with the "Imaging for NT" application.

Any ideas?  Thanks much,

       - Randy

Image-SIG maillist  -  Image-SIG@python.org