I want to compare bitmap which is stored in a local drive(For Example: "E:\Bitmap1.bmp") with a bitmap which is captured by script while automating the application. I used this script. Iam getting it not equal is this the right way to compare images?
Set w1 = Sys.Desktop.Picture
Log.Picture w1, "Screen Image"
Set w2 = Utils.Picture
if w1.compare(w2) Then
Log.Message("Pictures are Equal")
The code looks fine for comparing images, the question is whether or not the images are actually the same.
If you are capturing your desktop and you desktop contains the current date and time (such as in the SysTray in windows), then any live capture you make will not match the current desktop.
The other possibility could be that Bitmap1.bmp was saved using a different resolution than what you're currently running on the machine.
Essentially, that compare method, if even 1 pixel is off, they will come back as different. I believe there is a tolerance level you can set in your compare method. Please read the help topic on Picture.Compare for more information.