# ocr

Read text from the screen or an image.

```js
ocr(options = {})
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `options.image` | string | Optional image path; missing/unreadable files fall back to the screen. Check fileExists when a file is required. |
| `options.level` | number | 0 = accurate (default), 1 = fast. |
| `options.languages` | string[] | Optional supported language codes. |
| `options.coordinates` | string | "points" by default; use "pixels" for touch coordinates. |
| `options.region` | object | Optional {x,y,width,height} in the chosen coordinate units. |

## Returns

[results, null] or [null, errorString]. Each result has text, confidence and rectangle: {x,y,width,height,topLeft,topRight,bottomLeft,bottomRight}. Empty results are successful.

## Example

```js
const [items, error] = ocr({level: 0, coordinates: "pixels"});
if (error) throw new Error(error);
for (const item of items) console.log(item.text, JSON.stringify(item.rectangle));
```

## Notes

Result rectangles already include crop offsets. Do not add them again. Use the same image geometry as the current screen; OCR text can be wrong.

[All JavaScript APIs](https://mcp.applesauceos.com/doc/api.md) · [Automation playbook](https://mcp.applesauceos.com/doc/ai.md)
