During automation, I was given a task to compare two images. The catch here is to do it with fast running code which do not compromise performance.
Here I have found and tweaked a little code snippet. It is written in c#.
In this code, we are converting two Image objects into Base64 String. By Comparing the Base64 string together , we will know that whether images are same. The Code is below.
******start of the code*********
public static bool ImageCompareString(Image firstImage, Image secondImage)
var ms = new MemoryStream();
String firstBitmap = Convert.ToBase64String(ms.ToArray());
ms.Position = 0;
String secondBitmap = Convert.ToBase64String(ms.ToArray());
*****end of code********