Created
May 2, 2014 13:41
-
-
Save utgwkk/ee79149ca9737137277d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
from PIL import Image | |
from glob import glob | |
flist = [] | |
fhist = [] | |
dl = [] | |
dirname = './images/' | |
for e in ['png', 'jpg']: flist.extend(glob('%s/*.%s'%(dirname,e))) | |
for fn in flist: fhist.append(Image.open(fn).histogram()) | |
for i in xrange(len(flist)): | |
if flist[i] in dl: continue | |
for j in xrange(i+1, len(flist)): | |
if flist[j] in dl: continue | |
if fhist[i] == fhist[j] and not flist[j] in dl: | |
dl.append(flist[j]) | |
for a in dl: os.remove(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment