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))

 

 posted on 2020-10-22 18:21  兰猫-兰兰  阅读(419)  评论(0编辑  收藏  举报