diff_sprites
Compare two frames pixel by pixel and report changed pixels as counts, revealing whether an edit landed on the wrong layer, frame, or selection.
Instructions
Compare two frames pixel for pixel and say what changed.
This is the tool for the question an editing agent cannot otherwise answer: *did my
last call do what I meant?* `assess_sprite` judges one frame on its own and
`render_preview` returns a picture a text-only model cannot read. This reports the
difference between two frames as counts, which is the only form in which "the shading
pass moved the outline" is visible without eyes.
**Nothing changed is the loudest result, not the quiet one.** An edit that silently
went nowhere, to the wrong layer, inside a stale selection, off the canvas, looks
exactly like an edit that was not needed. When the two frames are identical this says
so first and names the usual causes.
A difference is never reported as a fault, because different is not wrong. Pass
`expect` to turn the measurement into a check.
Args:
filename: The sprite to compare, and the "before" side of the report.
frame: Which frame of it (1-based).
layer: Compare this layer alone instead of the composite, on both sides unless
`other_layer` says otherwise. Worth reaching for: drawing tools write to ONE
layer, so a composite diff can show nothing while the layer underneath
changed completely, and the reverse.
other: The sprite to compare against. Defaults to `filename`, which is what makes
a frame-to-frame diff inside one animation this same call.
other_frame: Which frame of `other` (1-based).
other_layer: The layer to read on the `other` side, when it is named differently.
expect: What the change should be: "identical", "silhouette", "interior",
"coverage" or "mixed". Adds a verdict block with a pass or a fail, and is
omitted rather than guessed at.
Returns counts in four buckets that add up to `changed_pixels`, so a change is never
reported as a single number that could mean two different things:
* `silhouette_added` / `silhouette_removed`: pixels that entered or left the shape.
These are the ones that move a collision box, an outline and a trimmed export box.
* `interior_changed`: pixels that were visible before and after and changed colour.
* `coverage_changed`: pixels that kept their colour and changed only their alpha,
which is an opacity or anti-aliasing change rather than a repaint.
Both frames must be the same size; a mismatch is refused with both canvas sizes and
both content boxes, because a diff of differently sized frames is an offset question
in disguise. Different colour modes compare fine: both sides are read as RGBA, so an
indexed sprite and its RGB export can be checked against each other.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | No | Default: 1. | |
| layer | No | ||
| other | No | ||
| expect | No | ||
| filename | Yes | ||
| other_frame | No | Default: 1. | |
| other_layer | No |