I'm trying to iterate through all the pictures in a folder and resize them using the python thumbnail function. I get an error: IOError: cannot identify image file. Can anyone help me out on this one? It seems that it's not seeing the file as an image.
Code:
import Image, os
for filename in os.listdir('.'):
img = Image.open(filename)
img.thumbnail( (200,200) )
out = file(os.path.splitext(filename)[0]+"_thumb.jpg", "w")
try:
img.save(out, "JPEG")
finally:
out.close()