glass_diff
Diff the current GUI frame against a named baseline, returning change stats and the bounding box of altered pixels. Optionally include a cropped image of the changed region.
Instructions
Diff the current frame against a named baseline; returns change stats + bbox. Set include_image: true to also return the current frame cropped to the changed region (omitted when nothing changed).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | `"perceptual"` (default) or `"exact"`. | |
| name | Yes | Name of a baseline saved by `glass_baseline_save`; an unsaved name errors rather than reporting no change. | |
| ignore | No | Window-relative rectangles to exclude from the comparison. Use for perpetually animating content — a blinking text caret, a clock, a spinner — which otherwise keeps `changed_pct` permanently non-zero. `changed_pct` is measured over the pixels that remain; the excluded count is reported as `ignored_pixels`. Combines with `region`: rects are always window-relative and are intersected with it. | |
| region | No | Optional window-relative sub-rectangle to diff; omit to diff the whole window. Scopes the comparison (and the reported `bbox`, which becomes region-relative) to just this area — the way to ask "did *only* this part change?" Mirrors `glass_wait_for_region`'s `region`. | |
| threshold | No | Perceptual sensitivity for `mode="perceptual"`, 0..1 (default 0.1; smaller = stricter). | |
| tolerance | No | Per-channel tolerance for `mode="exact"` (default 0). | |
| include_image | No | Also return the current frame cropped to the changed region (default false). No image is returned when nothing changed. |