Stitches multiple scrolling screenshots into a single image. Supports both vertical (default) and horizontal stitching with automatic overlap detection and alignment using ORB feature matching...
Stitch multiple scrolling screenshots into one seamless image.
Use the Question tool to ask user ONE question only:
Question: Select stitch direction Options (exactly 2):
Vertical (top to bottom) - (Recommended) For vertically scrolling screenshotsHorizontal (left to right) - For horizontally scrolling screenshotsUse the Question tool to ask user ONE question only:
Question: How much overlap between screenshots? Options (exactly 3):
Small overlap - Screenshots have minimal overlap (~10-20%)Medium overlap - (Recommended) Screenshots have moderate overlap (~20-40%)Large overlap - Screenshots have significant overlap (~40%+)Based on user choice, set the edge parameter for modifying stitch.py:
EDGE_PARAM=150EDGE_PARAM=300EDGE_PARAM=600CRITICAL: Must run this BEFORE any stitching. The skill directory contains a venv that needs activation.
# Get skill directory (where stitch.py lives)
SKILL_DIR="/path/to/image-stitch" # Replace with actual skill path
# Activate venv and install dependencies (idempotent)
cd "$SKILL_DIR" && \
python3 -m venv venv 2>/dev/null || true && \
source venv/bin/activate && \
pip install -q opencv-python numpy
# Modify stitch.py edge parameters based on user's overlap choice
EDGE_PARAM=300 # Set this based on Step 2 user choice
sd "edge_h = min\([0-9]+, h1 // 4, h2 // 4\)" "edge_h = min($EDGE_PARAM, h1 // 4, h2 // 4)" stitch.py
sd "edge_w = min\([0-9]+, w1 // 4, w2 // 4\)" "edge_w = min($EDGE_PARAM, w1 // 4, w2 // 4)" stitch.py
Create task folders with timestamp:
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
mkdir -p "$SKILL_DIR/input/$TIMESTAMP"
mkdir -p "$SKILL_DIR/output/$TIMESTAMP"
Copy images from source to input/$TIMESTAMP/, renaming by sequence order.
IMPORTANT: Use find command to handle paths with spaces and special characters correctly.
SOURCE_PATH="/path/to/source" # User provided path
# Find and copy images, sorted by filename, renamed to 01.png, 02.png, etc.
find "$SOURCE_PATH" -maxdepth 1 -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" \) | \
sort | \
nl -nrz -w2 | \
while read num file; do
cp "$file" "$SKILL_DIR/input/$TIMESTAMP/${num}.png"
done
Verify copied files:
ls -la "$SKILL_DIR/input/$TIMESTAMP/"
IMPORTANT: Must run with venv activated.
cd "$SKILL_DIR" && source venv/bin/activate && \
python stitch.py \
-i "input/$TIMESTAMP" \
-o "output/$TIMESTAMP/stitched.png" \
--debug \
[--horizontal] # Add this flag if user chose horizontal
After stitching, report to user with full absolute path:
Stitching complete!
Task ID: $TIMESTAMP
Input: $SKILL_DIR/input/$TIMESTAMP/ (<N> images)
Output: $SKILL_DIR/output/$TIMESTAMP/stitched.png (<W>x<H>)
Full output path:
$SKILL_DIR/output/$TIMESTAMP/stitched.png
Use the Question tool to ask user ONE question only:
Question: Open output folder in Finder? Options (exactly 2):
Yes - Open the output folderNo - Skip opening folderIf user chooses "Yes", run:
open "$SKILL_DIR/output/$TIMESTAMP"
| Option | Description |
|---|---|
-i, --input |
Input folder (images sorted by filename) |
-o, --output |
Output path (default: output/stitched.png) |
-H, --horizontal |
Horizontal stitching mode |
--no-detect |
Disable overlap detection (direct concatenation) |
--debug |
Show detailed matching info |
Cause: venv not activated or dependencies not installed. Fix: Run Step 3 (Setup Environment) again.
Cause: Paths with spaces or special characters not quoted properly.
Fix: Always use find with proper quoting as shown in Step 5.
Cause: Brace expansion {a,b} not supported in all shells.
Fix: Use find with -iname instead of glob patterns.
Dependencies are auto-installed in venv during Step 2.