Skip to content

Instantly share code, notes, and snippets.

@austinkelleher
Created September 11, 2014 17:57
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 austinkelleher/60120d8c1983816a1551 to your computer and use it in GitHub Desktop.
Save austinkelleher/60120d8c1983816a1551 to your computer and use it in GitHub Desktop.
Python function to compare the bytes from two images to see if they're identical.
__author__ = "Austin Kelleher"
__email__ = "a@alk.im"
def isIdenticalImage(a, b):
"""
Returns true if an image, a, is completely identical
to an image, b, by comparing the bytes from each image.
a, and b, are the respected string paths to the images.
r+b is used so that this is functional on Windows/UNIX
"""
return open(a, 'r+b').read() == open(b, 'r+b').read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment