from PIL import ImageChops, Image image_one = Image.open('pic_1.png') image_two = Image.open('pic_1_same.png') diff = ImageChops.difference(image_one, image_two) try: if diff.getbbox() is None: print("【+】We are the same!") else: diff.save('diff.png') except ValueError as e: text = ("We are different!") print("【{0}】{1}".format(e, text))
Thanks,
Ivan