ApplesauceOS
Read Markdown ↗Download .md

findImage

Find a template image on the screen.

js
findImage(options)

Arguments

ArgumentTypeMeaning
options.targetImagePathstringOpaque template file. Relative paths resolve from the script/project directory.
options.thresholdnumberSimilarity threshold -1..1; default 0.9.
options.countnumberDefault 10; 0 = all.
options.regionobject | arrayOptional native-pixel rectangle.
options.methodnumberOnly 1 is supported.
options.debugbooleanOptional 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.

All JavaScript APIs · Automation playbook