Spot the difference between two images using Python Last Updated : 24 Feb, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss how to spot differences between two given images using python. In order to perform this task, we will be using the ImageChops.difference() method in Pillow module. Syntax: ImageChops.difference(image1, image2) Parameters: image1 first imageimage2 second image Return Value: It returns an Image. Step-by-step Approach: Step 1: So, today we will be building this magical tool using python and that too with only 8 lines of code. But, before that, we have to install the pillow package of python using this command pip install pillow Step 2: Now, after installing this we have to get two images. Make sure that these two images are in the same folder where you've kept this python program or else you've to provide the path of these images. Step 3: Call the ImageChops.difference() method with the two images as parameters. Step 4: Generate the difference between the two images using the show() method. Implementation: Input: Python3 # import module from PIL import Image, ImageChops # assign images img1 = Image.open("1img.jpg") img2 = Image.open("2img.jpg") # finding difference diff = ImageChops.difference(img1, img2) # showing the difference diff.show() Output: Notice that the output image contains mostly black parts, but some portions of this image are colored. Those colored portions are the spotted differences between the two input images. In this case, the output image shows a total of 6 major differences. Comment More infoAdvertise with us Next Article Spot the difference between two images using Python S saranshsahgal Follow Improve Article Tags : Technical Scripter Python Technical Scripter 2020 Python-pil Practice Tags : python Similar Reads Finding Difference between Images using PIL Python interpreter in itself doesn't contain the ability to process images and making out a conclusion to it. So, PIL(Python Imaging Library) adds image processing powers to the interpreter. PIL is an open-source library that provides python with external file support and efficiency to process image 2 min read How to subtract two images using Python-OpenCV ? In this article, we are going to see how to subtract two images using OpenCV in Python. Now, before getting into the topic we shall discuss some of the use cases of Arithmetic operations. Arithmetic operations like addition and subtraction can help us to make images brighter or darker. Specifically, 3 min read Convert image to binary using Python In this article, we are going to convert the image into its binary form. A binary image is a monochromatic image that consists of pixels that can have one of exactly two colors, usually black and white. Binary images are also called bi-level or two-level. This means that each pixel is stored as a si 1 min read Python | Visualizing image in different color spaces OpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on pictures or videos. It was originally developed by Intel but was later maintained by Willow Garage and is now maintained by Itseez. This library is cross-platform that is it is 4 min read Check if the image is empty using Python - OpenCV Prerequisite: Basics of OpenCV OpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on pictures or videos. It was originally developed by Intel but was later maintained by Willow Garage and is now maintained by Itseez. This library i 2 min read Like