Ranorex

English|Deutsch

Image Recognition

This Documentation is only for Ranorex 1.x versions.

Click here for the Ranorex 2.0 documentation

The following code examples show how you can find and compare images within controls.

Using the FindImage method

You can find an image within a control either by image-filename or by location.

The function searches an image loaded from a file on the screen within the control rectangle.

C#

toolStrip.FindImage("Example.bmp", out foundLocation);

or

The function searches an image on the screen within the control rectangle. The positions are given in screen coordinates that are relative to the upper-left corner of the screen.

C#

toolStrip.Findimage(location, size, out foundLocation);

Using the CompareImage method

You can compare images in three different ways:

  • compare the images of two controls
  • compare the image of the control with an image on the screen
  • compare the image of the control with an image-file


The function compares the image of the control with the image of an other control.

C#

toolStrip.CompareImage(toolStrip2);

The function compares the image of the control with an other image on the screen.
The positions are given in screen coordinates that are relative to the upper-left corner of the screen.

C#

toolStrip.CompareImage(location, size, offset);

Compares the image of the control with another image loaded from a file.
The offset is given in screen coordinates that are relative to the upper-left corner of the control.

C#

toolStrip.CompareImage("Example.bmp", offset);