User:Cristinac/Project01: Difference between revisions
(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 ...") |
No edit summary |
||
Line 1: | Line 1: | ||
Python script: | |||
<source lang="python"> | <source lang="python"> | ||
from PIL import Image | from PIL import Image |
Revision as of 16:36, 17 February 2015
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