User:Cristinac/Project01

From XPUB & Lens-Based wiki
< User:Cristinac
Revision as of 16:35, 17 February 2015 by Cristinac (talk | contribs) (Created page with "::Python script: <source lang="python"> 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 ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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