1.1.2 Screen.capture(region, 'name') not working

Asked by Edson Henrique Arantes

I want to save a region as a png file to process it in another app, so, no temporary save
my code is as follows:

calc = find("calculator.png")

rows = 10
cols = 4
calc.setRaster(rows, cols)
result = calc.getRow(2) # result is a new region

path = Screen.capture(result,'result.png') # the .png part can be omitted, path should have the absolute path to the image named result.png

getting the error:
"TypeError: capture(): self arg can't be coerced to org.sikuli.script.Screen "

read the documentation but I can't understand what's wrong

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Edson Henrique Arantes
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

must be used as (only available in Python scripting):
capture(result,'result.png')

this stores the image in the scripts .sikuli folder.

Be aware: the actual name of the image will be _result.png.

the leading underscore takes care, that the image is not deleted at time of script save (images not referenced in the script are purged in the standard)

Revision history for this message
Edson Henrique Arantes (jovemhenrique) said :
#2

it works, thank you very much!