Wing Posted June 18, 2007 Posted June 18, 2007 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: 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; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.