Sikuli won't find previously captured image

Asked by Miguel E Torrealba on 2017-04-29

Hi, totally new to Sikuli and programming, great program!

I am having trouble making sikuli recognize an image in one region of the screen and then find it in another region of the screen. Everything works great with the regions but it just doesn't like captured images.

if exists("1493406248051.png"):

if exists("1493405892790.png"):

import shutil
import os

folder = "C:\SikuliX\RESUMEN"
img = capture(Region(183,75,35,36))
shutil.move(img, os.path.join(folder, "FORMA.png"))

reg2 = Region(Region(257,37,331,118))"C:\SikuliX\RESUMEN\FORMA.png")


I am absolutely sure the regions are right, and I checked the image captured by opening it on my hard drive and it's great. But it won't find FORMA.png

So to rule out a region problem I widened the search:

Which I suppose searches for it on the whole screen, but still doesn't even find the image on the same region it was captured.

Help please, thanks

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

folder = "C:\SikuliX\RESUMEN"

must be either
folder = "C:\\SikuliX\\RESUMEN" # escaped backslash

folder = r"C:\SikuliX\RESUMEN" # raw string

BTW: with version 1.1.1 in the IDE, you can name captured pictures at capture time:

Instead of something like this:
folder = "C:\SikuliX\RESUMEN"
img = capture(Region(183,75,35,36))
shutil.move(img, os.path.join(folder, "FORMA.png"))

you can simply do that:
in a line having
forma =

leave the cursor after the = and click the capture button.
after the capture, the image will be named forma.png and could be used either as"forma.png") or even"forma")

or using the variable

this feature from the beginning encourages a naming convention

Can you help with this problem?

Provide an answer of your own, or ask Miguel E Torrealba for more information if necessary.

To post a message you must log in.