This project has moved and is read-only. For the latest updates, please go here.

Compare Function

Oct 15, 2013 at 8:14 PM
Hi, I've been looking around for the answer for this, but I gave up and came straight to the source. How different can an image be before this returns a 1? I'm trying to compare 2 screenshots of our site for automation purposes, but I don't want it to break the test if the changes are negligible.
Oct 15, 2013 at 9:30 PM
Edited Oct 15, 2013 at 9:35 PM
Are you using Compare or CompareTo? The CompareTo method only checks the size (width * height). The Compare method returns an MagickErrorInfo object. You can find an explanation about the properties here: The method will return null if the images are completely equal, I will change this in the next release.
Oct 15, 2013 at 9:49 PM
Oh, I see. I was using the CompareTo Method. So, the MagickErrorInfo Object contains these Properties; mean error per pixel, normalized mean square error, and normalized maximum square error. Do you have any suggestions on where to start when looking for the best way to compare images with very few to no changes? I would guess that the images would match if the mean error per pixel was 0. Please, forgive my ignorance on this topic.
Oct 15, 2013 at 10:21 PM
Sorry, I missed the part about it returning null if the images are equal. Thanks for your help :)
Oct 15, 2013 at 10:44 PM
In the next release I will change this and return an MagickErrorInfo object. This will make it easier to check if the images are almost equal. And you are right, when the images are equal the value of mean error per pixel will be 0.