Whether you want to build an application with spot the difference feature or if you want to compare two images programmatically within any of your .NET based image processing applications, you are at the right place. After this article, you can easily compare JPG, PNG, BMP, or images with some other file formats. Without wasting time, let’s compare images in C# using the .NET API for document and image conversion.
.NET Image Comparison API
I will be using GroupDocs.Comparison for .NET API for comparing images in this article. This API supports comparing JPG, PNG, BMP, DICOM, DCM, DjVu images along with many other supported file formats.
PM> Install-Package GroupDocs.Comparison
Compare Images to Highlight Differences using C#
Comparing two images in C# is too easy with GroupDocs.Comparison within .NET application. The following steps explain how we can compare any two JPG, PNG, BMP, or any other image. It successfully detects the changes and highlights them in the output/resultant image.
- Define the first image using the Comparer class.
- Add the second image using Add method of Comparer object.
- Call Compare method to compare both the images and save the resultant image that highlights the differences among both the images.
The code below shows how you may do image comparison in C# and as an example, it compares two JPG images and saves the output with differences.
The images shown at the start of the article are used in this code. Images on the left are compared, and the output is shown on the right side that highlights the differences.
In this article, we have learned image comparison using C# with .NET API. Now you can build your own application to compare images and highlight the found differences.
To get a complete idea about the features of the API, you can go through the Documentation. You may also contact the Free Support Team or Free Consulting Team that even writes code to help you understand the usage of GroupDocs APIs as per your requirements.