screen

screen.screen.find_image

Declaration
lua
screen.find_image(path_or_paths, similarity [, x1, y1, x2, y2 [, mode]])
Description
Find template image on screen. Supports single or multi-template (first match wins). Auto mode: binary → gray → edge fallback.
Parameters
`path_or_paths` (string or table) — image path or array of paths `similarity` (number) — match threshold 1-100 `x1,y1,x2,y2` (number, optional) — search region `mode` (string, optional) — 'binary'/'gray'/'normal'/'fast' (default: auto)
Return Values
`number` x, y, x2, y2, similarity — or nil×5 if not found
Example
lua
local x, y = screen.find_image("btn.png", 80)
local x, y = screen.find_image({"ok.png", "cancel.png"}, 80)
local x, y = screen.find_image("btn.png", 85, 0, 0, 750, 1334, "binary")
Notes
Template cache: 16 entries, FIFO. Binary mode fastest for UI elements.