Skip to content

feat: add --compare flag for before/after comparison output#24

Open
hai-pilgrim wants to merge 1 commit into
marksverdhei:mainfrom
hai-pilgrim:feat/before-after-compare
Open

feat: add --compare flag for before/after comparison output#24
hai-pilgrim wants to merge 1 commit into
marksverdhei:mainfrom
hai-pilgrim:feat/before-after-compare

Conversation

@hai-pilgrim
Copy link
Copy Markdown

Summary

  • Adds --compare CLI flag to spritegrid
  • When set, outputs a side-by-side comparison image with "Before" and "After" labels instead of just the processed result
  • The processed image is upscaled to the original's dimensions using NEAREST resampling (pixel-art safe) before compositing
  • Suppressed in --debug mode and when the image is already clean pixel art (1:1 detection)
  • 9 new unit tests in tests/test_compare.py

Usage

spritegrid input.png --compare -o comparison.png
spritegrid input.png --compare -i  # show in viewer

Test plan

  • 44 tests pass (uv run pytest)
  • test_compare.py covers size, pixel content, RGBA handling, and parameter variants

Closes #16

🤖 Generated with Claude Code

Adds a --compare CLI flag that outputs a side-by-side comparison image
instead of just the processed result. The after image is upscaled to the
original's dimensions using NEAREST resampling (preserving pixel edges),
then placed alongside the original with "Before" / "After" labels.

  spritegrid input.png --compare -o comparison.png

Comparison is suppressed in debug mode (--debug) and when the image is
already clean pixel art (1:1 detection). Includes 9 unit tests.

Closes marksverdhei#16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add before / after cli target or script

2 participants