Created
September 11, 2014 17:57
-
-
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.
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
__author__ = "Austin Kelleher" | |
__email__ = "[email protected]" | |
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