Ranorex image validation

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Posts: 4
Joined: Mon Jan 14, 2013 2:31 pm

Ranorex image validation

Post by Lightning » Mon Jan 14, 2013 2:46 pm


Sorry first post so apologies if I am posting in the wrong area, I have searched the forums and could not find an answer to my question so again apologies if i've missed a previous answer to this question.

Just a small query, I am able to easily validate an image within my AUT but as part of a further test I have used the functionality within to export a copy of this image as a .tif file (this is the only file format available in the AUT).

Opening this file and validating it with Ranorex is proving difficult, with the default windows photo viewer every time the image opens and closes it is identified as a different element by the Ranorex spy, I have tried using paint dot net instead but the Ranorex recorder will not allow validation on the image it doesn't seem capable of reading it correctly with an error of "Validation failed. The element might no longer be available". I was just wondering is there a particular application for viewing image files that people would recommend for use with Ranorex? cheers

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex image validation

Post by Support Team » Mon Jan 14, 2013 4:44 pm


You could use file-based image validation in order to achieve this.
This dynamic approach allows bitmap images (e.g. bmp, jpeg, tif, png) to validate.

Please take a look at the enclosed example (please use Internet Explorer).
More examples can be found in our User Guide.
Please let me know if you need further information.

Markus (T)
(1.23 MiB) Downloaded 650 times

Posts: 87
Joined: Sun Aug 05, 2012 11:59 am
Location: Bilbao, Spain

Re: Ranorex image validation

Post by mdgairaud » Tue Feb 12, 2013 10:48 am


Recently I have to use the image comparison and I use this simple method (it's a stripped version from the one I use):

Code: Select all

CompressedImage miImage = ElementWithTheImage.CaptureCompressedImage();

if (Compare(miImage, 0.99))
	Console.WriteLine("match found!!");
	//do something: Click, MoveTo, ...

private bool Compare(Bitmap miImage, double simmilarity)
	double result;

	Bitmap bmp = Ranorex.Imaging.Load(imageToCompare); //from file
	result = Ranorex.Imaging.Compare(miImage, bmp);

	Console.WriteLine("Comparison result : " + result);

	if (result > simmilarity)
		return true;
	return false;

It's very simple:
1. capture in memory the image of the element (I think it's captured in bmp)
2. compare it against one bmp in disk with a tolerance of at least 0.99 (99%)
3. if the comparison result gives a result of 0.99 or better it returns true

hope it helps. :D