User:Cristinac/Project01

From XPUB & Lens-Based wiki

Python script:

from PIL import Image

def avg(p):
	pil_im = Image.open(p)

	i=pil_im.convert('L')
	i.thumbnail((1,1))
	g=i.getpixel((0,0))
	return g

from glob import glob

imgs = glob("*.jpeg")    
imgs.sort()

d = []
for x in imgs:
	d.append((avg(x), x))
d.sort()
print d