How does PIL handle seek() function to operate within multiframe .tiff files? I'm trying to extract a piece of information (greyscale pixel values) of various frames in the file, but no matter what I set the seek for, EOFE error is raised. Example code:
from PIL import Image
im = Image.open('example_recording.tif').convert('LA')
width,height = im.size
image_lookup = 0
total=0
for i in range(0,width):
for j in range(0,height):
total += im.getpixel((i,j))[0]
total2=0
im.seek(1)
for i in range(0,width):
for j in range(0,height):
total += im.getpixel((i,j))[0]
print total
print total2
The error log looks like this:
File "C:\Users\ltopuser\Anaconda2\lib\site-packages\PIL\Image.py", line 1712, in seek raise EOFError
EOFError
Cheers, JJ