Screenshot Diff

Description

XSpoonAi 6fae31a 3 files · 11.0 KB Updated

File contents

Description

Compute simple pixel diffs between two images. Useful for visual regression testing and screenshot comparison in automation workflows.

Inputs

{
  "image1": "Path or base64 of first image",
  "image2": "Path or base64 of second image",
  "threshold": "Pixel difference threshold"
}

Outputs

{
  "ok": true,
  "data": {
    "diff_percentage": "5.2%",
    "changed_pixels": 1250,
    "identical": false
  }
}

Usage

Demo Mode

python scripts/main.py --demo

Compare Images

echo '{"image1":"before.png","image2":"after.png"}' | python3 scripts/main.py

Examples

Example 1: Visual Regression Test

$ echo '{"image1":"screenshot1.png","image2":"screenshot2.png"}' | python3 scripts/main.py
{
  "ok": true,
  "data": {
    "diff_percentage": "2.3%",
    "changed_pixels": 450,
    "identical": false
  }
}

Error Handling

When an error occurs, the skill returns:

{
  "ok": false,
  "error": "Error description",
  "details": {
    "image1": "File not found"
  }
}

XSpoonAi/spoon-awesome-skill/tree/main/ai-productivity/screenshot-diff commit 6fae31a557

Frequently asked questions

npx skillmds@latest add xspoonai/screenshot-diff