Fast and efficient way to detect if two images are visually identical in Python
问题 Given two images: image1.jpg image2.jpg What's a fast way to detect if they are visually identical in Python? For example, they may have different EXIF data which would yield different checksums, even though the image data is the same). Imagemagick has an excellent tool, "identify," that produces a visual hash of an image, but it's very processor intensive. 回答1: Using PIL/Pillow: from PIL import Image im1 = Image.open('image1.jpg') im2 = Image.open('image2.jpg') if list(im1.getdata()) == list