Skip to content

Instantly share code, notes, and snippets.

@krikulis
Created August 31, 2010 11:18
Show Gist options
  • Save krikulis/558880 to your computer and use it in GitHub Desktop.
Save krikulis/558880 to your computer and use it in GitHub Desktop.
# 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