-
Notifications
You must be signed in to change notification settings - Fork 1
/
quicktest.py
executable file
·53 lines (46 loc) · 1.48 KB
/
quicktest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python
import sys
import Image
import os,glob
def is_the_same(base, test_image):
for i in range(len(base)):
for j in range(len(base[i])):
if (base[i][j] - test_image[i][j]) != 0:
return False
return True
def main():
base = Image.open('Picture-1.png').getdata()
bad = Image.open('Picture-2.png').getdata()
badder = Image.open('Picture-3.png').getdata()
good = Image.open('Picture-4.png').getdata()
#print is_the_same(base, bad) # returns True
#print is_the_same(base, badder) # returns True
print is_the_same(base, good) # returns False
#a = Image.open('Picture-1.png')
#b = Image.open('Picture-2.png')
#print a.tostring()
#print b.tostring()
#path = "/Users/dmc186/Pictures/iPhoto\ Library/Data/iPhotoOriginals/2003/Orange\ Bowl\ 2006/"
path = "/Users/dmc186/Pictures/iPhoto Library/Data/2003/Orange Bowl 2006"
if os.path.isdir(path):
print "path yo"
index = 0
myfiles = glob.glob( os.path.join(path, '*.*'))
#for infile in glob.glob( os.path.join(path, '*.*') ):
for infile in myfiles:
index += 1
base = Image.open(infile).getdata()
complist = myfiles[index:]
for comp in complist:
check = Image.open(comp).getdata()
status = is_the_same(base, check)
if status:
print "-------------------------------------------"
print infile
print comp
print "-------------------------------------------"
else:
print "fail."
print "done."
if __name__ == '__main__':
main()