I'm trying to get Python to read exactly how many pages are in a .TIF and I've modified some code from some help I got yesterday. I've gotten Python to read the .TIF file, and output the pages, however it only reads the first .TIF file it can find. I need it to go through all the .TIF files in the same location.
I was wondering how can I make it so that once it is done counting, it will continue to the next file until it is completely done.
Here is what I have so far
import os
from PIL import Image
count = 0
i = 0
tiffs_path = "c:\\tiftest"
for filename in os.listdir("c:\\tiftest"):
if filename.endswith(".TIF"):
img = Image.open(filename)
while True:
try:
img.seek(count)
print(filename)
print(count)
except EOFError:
break
count += 1
print(count)