loading...

How to compare two images in C# .NET

atir_tahir profile image Atir Tahir Originally published at blog.groupdocs.com ・1 min read

GroupDocs.Comparison is a document comparison API that correlates content and style, it detects number of inserted/deleted or style changed items and generates a summary.

How GroupDocs.Comparison works for Image Comparison?
The comparison starts with the upper left corner and compares the entire image pixel by pixel. If the pixels are the same, it moves on to the next one and so on until it finds a difference. The changed pixels are given an ID. It is defined as dabbed, deleted or changed. They are highlighted in a specific color (blue, red or green according to the standard settings).

Source Image
Alt Text

Target Image is same as source image except it has some extra objects on the table and some new code lines in the text editor.
Alt Text

Comparison Result
Alt Text

API successfully detects the changes and highlights them in the output/resultant image. In this case it highlighted the inserted items (e.g glasses, mug and some changes in the code).
This is how you do image comparison using GroupDocs.Comparison for .NET

Get access to the API resources.

Posted on by:

atir_tahir profile

Atir Tahir

@atir_tahir

Software developer and evangelist.

Discussion

markdown guide
 

Visual comparison is kinda useless. This algorithm works fine, it generates a small reliable image hash: codeproject.com/Articles/374386/Si...

 

Not useless at all if you are looking for a quick image comparisons solution. Or if you just want to point out where is the difference, visually.