8. ImageChops difference
8.1. Difference
Use the
ImageChops.difference(image1, image2)
method to return the absolute value of the pixel-by-pixel difference between the two images.out = abs(image1 - image2)
from PIL import Image, ImageChops
with Image.open("test_images/crosses.png") as im1:
with Image.open("test_images/circles.png") as im2:
im_out = ImageChops.difference(im1, im2)
im_out.save("chops/difference.png")