Created
April 7, 2017 18:40
-
-
Save stucka/6c32d21bc0ab5e32b1d1056b7193b449 to your computer and use it in GitHub Desktop.
Get list of image dimensions from a folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import os | |
folder = "./static/imgoriginals/" | |
print("Width\tHeight\tFilename") | |
for lead in os.listdir(folder): | |
filename = os.path.join(folder, lead) | |
im = Image.open(filename) | |
width, height = im.size | |
try: | |
im = Image.open(filename) | |
width, height = im.size | |
print(str(width) + "\t" + str(height) + "\t" + filename) | |
except: | |
print("!\t!\t" + filename) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment