Sunday, March 17, 2013

How to compare two images using QTP

We know by using Bitmap checkpoint, we can compare two images.

But is there a other way we can compare?

Yes, we can use "IsEqualBin" method from Mercury.FileCompare

sImgPath1="C:\Users\user\Downloads\SAI 01461_exposure.JPG"
'sImgPath2="C:\Users\user\Downloads\SAI 01462_exposure.JPG"
sImgPath2="C:\Users\user\Downloads\SAI 0175_exposure.JPG"
Set obj=createobject("Mercury.FileCompare")
retVal=obj.IsEqualBin(sImgPath1,sImgPath2,1,1)
print retVal
Set obj=nothing

The retVal=1 if both the images are same
else retVal=0

9 comments:

Innovapath said...

Excellent Post.Also Visit http://www.whiteboxqa.com/WBQA/SEO/qtp-videos.php

Unknown said...

very needful information.. Thanks a lot..

Unknown said...

Hi Author,

Nice One..

I have a query, If I open the same image file in MS PAINT and saved it again in jpg mode and then I am trying to compare those two images.

This code is throwing "ZERO" instead of "ONE".

Admin said...
This comment has been removed by the author.
Admin said...

Hi Friends I got #free #Amazon #Gift #Codes on this website

http://freegiftcodegenerator.com?ref=20160523947110

OnlineTrainer said...

Once automated tests have been developed, they can be run quickly and repeatedly. This is great blog for beginner to learn about QTP. Thanks a lot admin to sharing this wonderful blog on QTP Software. Also Learn QTP from the best QTP Software Testing Course in India at CatchExperts.com

Padhma said...

Excellent incredible blog layout! How long have you been blogging for? you make running a blog look easy. The overall glance of your website is magnificent, let alone the content!
Back to original

Unknown said...

I do agree with all the ideas you have presented in your post. They’re really convincing and will certainly work. Still, the posts are very short for newbies. Could you please extend them a little from next time?..Keep this great work..
Dot Net Training in Chennai
Android Training in Chennai
Python Training in Chennai
Web Designing Training in Chennai

Unknown said...

Hi, what if I want to compare a bitmap checkpoint to an image file (jpg)? Is it possible? Thank you!