如何比较两张图片?我找到了 Python 的 PIL 库,但我不太明白它是如何工作的。
最佳答案
要检查 jpg 文件是否完全相同,请使用 pillow 库:
from PIL import Image
from PIL import ImageChops
image_one = Image.open(path_one)
image_two = Image.open(path_two)
diff = ImageChops.difference(image_one, image_two)
if diff.getbbox():
print("images are different")
else:
print("images are the same")
关于python - 比较图像 Python PIL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35176639/