findImage
Find a template image on the screen.
js
findImage(options)Arguments
| Argument | Type | Meaning |
|---|---|---|
options.targetImagePath | string | Opaque template file. Relative paths resolve from the script/project directory. |
options.threshold | number | Similarity threshold -1..1; default 0.9. |
options.count | number | Default 10; 0 = all. |
options.region | object | array | Optional native-pixel rectangle. |
options.method | number | Only 1 is supported. |
options.debug | boolean | Optional debug image; default false. |
Returns
[centerLocations, null] or [null, errorString]; centers are {x,y} in native pixels.
Example
js
const [hits, error] = findImage({targetImagePath: "assets/button.png", threshold: 0.95, count: 1});
if (error) throw new Error(error);
console.log(hits);Notes
Matches original template size; no automatic scale or rotation. Transparent templates are unsupported. A broad region can exceed the search size limit. Inspect matches before tapping.