Created
July 14, 2014 21:03
-
-
Save odyniec/b61d3580f114e576e96f to your computer and use it in GitHub Desktop.
Comparing two graphics files in Python (using PIL)
This file contains hidden or 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
from PIL import Image, ImageChops | |
def img_identical(file1, file2): | |
""" | |
Take two image file names and return a boolean value indicating if the | |
images are identical. | |
""" | |
im1 = Image.open(file1) | |
im2 = Image.open(file2) | |
return ImageChops.difference(im1, im2).getbbox() is None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment