Compare images
Compare two pictures pixel by pixel: whether they are the same, how much differs, where, and optionally a copy of the first with the changes in red.
Command in the Image recognition toolkit · id ooa.image/compare_images · 6 inputs (2 required), 5 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Image | File | Yes | First picture, e.g. the approved layout (PNG, JPG, BMP or GIF). | |
| Other | File | Yes | Second picture, e.g. a screen capture saved by an earlier step. | |
| Tolerance | Number | No | 10 | How different one pixel's colour may be and still count as the same, in percent (0 = exact); ignores compression noise and slight colour shifts. |
| Maximum difference percent | Number | No | 0 | Share of pixels that may differ while the pictures still count as the same. |
| Size mismatch | String | No | error | When the sizes differ: error stops with IMAGE.SIZE_MISMATCH; scale stretches the second picture to the first one's size first. |
| Difference image | File | No | Save a PNG copy of the first picture with the changed pixels in red here; none when empty. |
Outputs
| Output | Type | What it is |
|---|---|---|
| same | Boolean | True when no more than max_difference_percent of the pixels differ. |
| difference_percent | Number | Share of pixels that differ, 0 to 100, two decimals. |
| changed_pixels | Number | Number of pixels that differ. |
| changed_area | Dictionary | x, y, width and height of the box around every changed pixel (in the first image); empty when nothing changed. |
| difference_image | File | Path of the difference picture; empty when none was asked for. |