glass_diff
Compare current window pixels against a saved baseline to detect visual changes, returning change statistics and a bounding box for the affected region.
Instructions
Compare current visual evidence with a named pixel baseline; returns change stats and a bounding box. This is a single current-state comparison, not a wait for transition completion or stability; use glass_wait_for_region to wait for pixel change/match and glass_wait_stable for quiescence. Set include_image:true to return the changed crop when pixels differ.
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. |