Skip to content

Instantly share code, notes, and snippets.

@grapefrukt
Created December 8, 2010 10:16
Show Gist options
  • Save grapefrukt/733110 to your computer and use it in GitHub Desktop.
Save grapefrukt/733110 to your computer and use it in GitHub Desktop.
#aDir is a directory path
names = glob.glob(aDir + "/*.png") #file type of the packable images
#append to the list of image objects
if names:
images.extend(names);
# then sort later:
sortedImages = sorted([(i.size[1], name, i) for name,i in ((x,Image.open(x)) for x in images)], reverse=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment