Skip to content

Instantly share code, notes, and snippets.

@anandkunal
Created March 8, 2010 07:38
Show Gist options
  • Save anandkunal/324968 to your computer and use it in GitHub Desktop.
Save anandkunal/324968 to your computer and use it in GitHub Desktop.
I whipped up this quick recipe using the Python Imaging Library. It's nothing fancy, but it gets the job done. Hacking this script to scoop/compare images in a directory is rather trivial.
import Image
def is_the_same(base, test_image):
for i in range(len(base)):
if (base[i] - test_image[i]) != 0:
return False
return True
base = Image.open('base.png').getdata()
bad = Image.open('bad.png').getdata()
good = Image.open('good.png').getdata()
print is_the_same(base, bad) # returns True
print is_the_same(base, good) # returns False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment