Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

nocoo/image-stitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Έ Image Stitch

Python OpenCV License

🧩 Seamlessly stitch multiple scrolling screenshots into a single image.

A simple yet powerful tool for combining sequential screenshots captured from scrolling content. Perfect for creating long screenshots of web pages, chat conversations, documents, and more.

✨ Features

  • πŸ”„ Automatic Overlap Detection - Uses ORB feature matching to find and align overlapping regions
  • ↕️ Vertical Stitching - For up/down scrolling content (default)
  • ↔️ Horizontal Stitching - For left/right scrolling content
  • 🎯 Smart Alignment - Corrects minor horizontal/vertical misalignment between images
  • βœ‚οΈ Auto Cropping - Trims output to the common region across all images

πŸ“‹ Requirements

  • Python 3.10+
  • opencv-python >= 4.8.0
  • numpy >= 1.24.0

πŸš€ Installation

# Clone the repository
git clone https://github.com/yourusername/skill-image-stitch.git
cd skill-image-stitch

# Create virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

πŸ“– Usage

Basic Usage

# Stitch images from a folder (vertical, sorted by filename)
python stitch.py -i input/ -o output/result.png

# Horizontal stitching
python stitch.py -i input/ -o output/result.png --horizontal

# Specify individual images
python stitch.py img1.png img2.png img3.png -o result.png

Command Line Options

Option Short Description
--input -i Input folder containing images (sorted by filename)
--output -o Output file path (default: output/stitched.png)
--horizontal -H Use horizontal stitching mode
--no-detect Disable overlap detection (direct concatenation)
--debug Show detailed matching information

Examples

# Stitch chat screenshots vertically
python stitch.py -i screenshots/chat/ -o chat_full.png

# Stitch panorama images horizontally
python stitch.py -i screenshots/panorama/ -o panorama.png -H

# Debug mode to see matching details
python stitch.py -i input/ -o output.png --debug

πŸ”§ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Image 1   β”‚
β”‚             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  β”‚ Overlap  β”‚          β”‚
β””β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
   β”‚       Image 2       β”‚
   β”‚                     β”‚
   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  β”‚     Overlap      β”‚          β”‚
   β””β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
      β”‚         Image 3             β”‚
      β”‚                             β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  ↓
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                             β”‚
      β”‚      Stitched Result        β”‚
      β”‚                             β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. πŸ” Feature Detection - Extracts ORB keypoints from overlap regions
  2. πŸ”— Matching - Finds corresponding points between consecutive images
  3. πŸ“ Offset Calculation - Computes overlap amount and alignment shift
  4. πŸ–ΌοΈ Stitching - Places images on canvas with calculated offsets
  5. βœ‚οΈ Cropping - Trims to the common visible region

πŸ’‘ Tips for Best Results

βœ… Do ❌ Don't
Keep 20%+ overlap between images Use images with no overlap
Maintain similar dimensions Mix very different sized images
Include content-rich overlap areas Overlap on solid color regions
Use consistent scroll direction Change scroll direction mid-capture

πŸ“ Project Structure

skill-image-stitch/
β”œβ”€β”€ πŸ“„ SKILL.md           # Skill definition for AI agents
β”œβ”€β”€ 🐍 stitch.py          # Main stitching script
β”œβ”€β”€ πŸ“‹ requirements.txt   # Python dependencies
β”œβ”€β”€ πŸ“– README.md          # This file
β”œβ”€β”€ πŸ“‚ input/             # Default input directory
└── πŸ“‚ output/            # Default output directory

⚠️ Limitations

  • Maximum 10 images per stitch operation
  • Requires 20%+ overlap for reliable matching
  • May struggle with:
    • Pure solid color regions
    • Highly repetitive patterns
    • Very low resolution images

🀝 Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments


Made with ❀️ for seamless screenshots

About

πŸ–ΌοΈ A Python tool for seamlessly stitching multiple scrolling screenshots into a single image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages