Hello,
I'm having a little bit of an issue with the CompareBitmaps> function
I'm trying to compare the attached 2 bmp files (grouptelecom*.bmp) which are very noticeably different and I'm always getting a 100% match yet when I compare the other 2 that are attached which are also slightly visibly different (bellon*.bmp) it's not 100% which is accurate.
Can you let me know why the grouptelecom files are considered the same by CompareBitmaps> and the other two are not.
Thanks in advance,
Dean[/img]
CompareBitmaps> functionality questions
Moderators: Dorian (MJT support), JRL
Firstly sorry to dig up this thread, but better recycled than new
I am also having this issue.
I read that in version 9.2 this could be an issue due to rounding but was subsequently fixed.
I'm now using Version 10 and for the life of me I still cannot get my two bitmaps to return me a decent match.
Currently I capture a small part of the screen which changes every 20 seconds. C1 would capture before the cycle, C2 after the cycle.
When I pause to compare the two bitmaps, I get a 100% match.
Here they are...
http://users.on.net/~rawill/Pics/c1.bmp
http://users.on.net/~rawill/Pics/c2.bmp
Thanks to anyone who can shed some light on this.
I am also having this issue.
I read that in version 9.2 this could be an issue due to rounding but was subsequently fixed.
I'm now using Version 10 and for the life of me I still cannot get my two bitmaps to return me a decent match.
Currently I capture a small part of the screen which changes every 20 seconds. C1 would capture before the cycle, C2 after the cycle.
When I pause to compare the two bitmaps, I get a 100% match.
Here they are...
http://users.on.net/~rawill/Pics/c1.bmp
http://users.on.net/~rawill/Pics/c2.bmp
Thanks to anyone who can shed some light on this.
Last edited by rawill on Sat Feb 23, 2008 11:34 am, edited 1 time in total.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Those are identical, because they are in fact the exact same file. They both link to the same place. It is possible that both your bitmaps contain exactly the same number of colors and pixels (though not exactly in the same place).
There's a much quicker, easier, way to compare two identically sized bitmaps if all you want to do is know whether they are different or not - just compare the MD5 checksum of the bitmap files themselves. Use the Hash library and compare the MD5 checksum of each bitmap. If the images are different the MD5 hash will differ. If they are identical the MD5 hash of the bitmap files will be identical. You can download the Hash library here:
http://www.mjtnet.com/plugins.htm
Here's an example that compares the two bitmap files:
Code: Select all
//Get MD5 hash of a file
LibFunc>d:\Hashlib,FileMD5,r1,D:\img\screen.bmp,buf1
Mid>r1_2,1,r1,hash1
//Get MD5 hash of a file
LibFunc>d:\Hashlib,FileMD5,r2,D:\img\screen2.bmp,buf2
Mid>r2_2,1,r2,hash2
If>hash1=hash2
MessageModal>Bitmap files are identical
else
MessageModal>Bitmap files are different
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Apoligies.
I tried about 8 different times to get my images to link and it appears on the last go I stuffed them up and linked the same file twice.
I couldn't get the img tags to work.
I have updated my original post with the correct links.
I tried about 8 different times to get my images to link and it appears on the last go I stuffed them up and linked the same file twice.
I couldn't get the img tags to work.
I have updated my original post with the correct links.
Last edited by rawill on Tue Feb 26, 2008 12:36 am, edited 1 time in total.
GetRectCheckSum is working great now, it definitely seems to be more accurate than CompareBitmaps.
Currently I use them both in combination. Mostly because I need to refer to static screen captures for some if statements.
Now that everything is running smoothly I added in a function to write results to a .txt file that gets converted to a .html file and uploaded via ftpput to my website.
Now I can watch my macro progress from work
Thanks for your reply Marcus.
Here is my checksum compare script very basic, but it does the job.
Currently I use them both in combination. Mostly because I need to refer to static screen captures for some if statements.
Now that everything is running smoothly I added in a function to write results to a .txt file that gets converted to a .html file and uploaded via ftpput to my website.
Now I can watch my macro progress from work
Thanks for your reply Marcus.
Here is my checksum compare script very basic, but it does the job.
Code: Select all
GetRectCheckSum>195,638,230,644,C1
Wait>7
GetRectCheckSum>195,638,230,644,C2
If>C1=C2
MessageModal>Is the same - C1: %C1% - C2: %C2%
Else
MessageModal>Is different - C1: %C1% - C2: %C2%
Endif