Created
August 31, 2010 11:18
-
-
Save krikulis/558880 to your computer and use it in GitHub Desktop.
This file contains 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
# atrod atteelus, kas ir mazaaki par 100x100 px un izdod nosaukumus. | |
import os | |
import Image | |
required_height = 100 | |
required_width = 100 | |
def find_small(directory): | |
for dirname, dirpath, filenames in os.walk(directory): | |
for filename in filenames: | |
try: | |
image = Image.open(os.path.join(dirname, filename)) | |
width, height = image.size | |
if width < required_width or height < required_height: | |
print "Image %s is too small " % (os.path.join(dirname, filename)) | |
except IOError: | |
print "File %s is not an image " % (os.path.join(dirname, filename)) | |
if __name__ == "__main__": | |
find_small("/home/kristaps/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment