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 comparison.

Compare Images for Differences using .NET

.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.

You can download the DLLs or MSI installer from the downloads section or install the API in your .NET application via NuGet.

PM> Install-Package GroupDocs.Comparison

Compare Images in C# to Highlight Differences

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 to compare two images in C#. 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 learned how to compare two images in C# using image comparison API. Now you can build your own image comparison application that can compare images and highlight the found differences to its users.

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.

See Also