compare_images
Compare two images to detect differences, returning the percentage of changed pixels and generating a highlighted diff image for visual regression testing.
Instructions
Compare two images and optionally create a diff image highlighting differences.
Returns the percentage of pixels that differ and creates a new image showing the differences if highlight_differences is True.
Useful for comparing before/after screenshots, detecting UI changes, or validating visual regression tests.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threshold | No | Color difference threshold (0-255). Pixels differing by more than this are marked. | |
| diff_color | No | Color to highlight differences | red |
| image_id_1 | Yes | ID of the first image | |
| image_id_2 | Yes | ID of the second image | |
| highlight_differences | No | Create a diff image highlighting differences |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Status message | |
| image_id | Yes | ID of the diff image created | |
| identical | Yes | True if images are identical | |
| difference_percentage | Yes | Percentage of pixels that differ |