Skip to content

Instantly share code, notes, and snippets.

@utgwkk
Created May 2, 2014 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save utgwkk/ee79149ca9737137277d to your computer and use it in GitHub Desktop.
Save utgwkk/ee79149ca9737137277d to your computer and use it in GitHub Desktop.
# 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