Hi, well i need to compare to images and iv found a way but was wondering if there is any faster way to do it.. any way here is my code:
Code:
public static bool CompareImage(Image img1, Image img2)
{
//Test to see if we have the same size of image
if (img1.Size != img2.Size)
{
return false;
}
else
{
//Convert each image to a byte array
System.Drawing.ImageConverter ic =
new System.Drawing.ImageConverter();
byte[] btImage1 = new byte[1];
btImage1 = (byte[])ic.ConvertTo(img1, btImage1.GetType());
byte[] btImage2 = new byte[1];
btImage2 = (byte[])ic.ConvertTo(img2, btImage2.GetType());
for (int i = 0; i < btImage1.Length; i++)
{
if (btImage1[i] != btImage2[i])
{
return false;
}
}
}
return true;
}