首页 > 编程语言 > 详细

Python比较图片的不同

时间:2020-10-22 19:26:30      阅读:18      评论:0      收藏:0      [点我收藏+]
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))

 

Python比较图片的不同

原文:https://www.cnblogs.com/ilazysoft/p/13860253.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!