Interactive GUI application for extracting individual photos from scanned images.
If you've scanned multiple physical photos on a flatbed scanner in one pass, scan-crop will automatically detect each photo and let you adjust the crop regions, apply rotations, and export them as separate high-quality JPEG files.
- Automatic photo detection using computer vision
- Interactive crop adjustment with mouse drag and resize
- Manual region creation by dragging on the canvas
- Rotation controls (90° increments) for each photo
- Live preview of selected photo with transformations
- Keyboard shortcuts for power users
- Batch export of all photos at once
- Command-line support for drag-and-drop workflow
No Python installation required!
- Download the latest
scan-crop.exefrom Releases - Run it directly - no installation needed
Requirements: Python 3.11 or higher
- Clone this repository:
git clone https://github.com/rusanu/scan-crop.git
cd scan-crop- Create a virtual environment and install dependencies:
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt- Run the application:
python scan_crop_gui.pyUsing the standalone executable:
- Double-click
scan-crop.exeto launch - Or drag a JPEG image file onto
scan-crop.exe - Or run from command line:
scan-crop.exe path\to\scan.jpg
Running from source:
python scan_crop_gui.py # Launch with file browser
python scan_crop_gui.py scan.jpg # Open specific image- Load an image - Click "Open Image..." or launch with a file path
- Review detected regions - Green boxes show automatically detected photos
- Adjust crop regions - Click and drag regions to move, drag corners/edges to resize
- Create manual regions - Drag on empty areas to create new crop regions
- Select a region - Click any region to select it (shows in right preview panel)
- Rotate photos - Use toolbar buttons or click region and use rotation controls
- Delete regions - Select unwanted regions and click "Delete Region" or press Delete
- Export all - Click "Export All Photos..." to save all regions to a folder
- Tab / Shift+Tab - Cycle through detected regions
- Arrow keys - Move selected region (1 pixel)
- Shift+Arrow keys - Resize selected region (1 pixel)
- Delete - Delete selected region
For the complete shortcuts list, see Help → Keyboard Shortcuts in the application.
- Scan Quality: Use 300 DPI or higher for best detection
- Spacing: Leave space between photos on the scanner bed
- Contrast: Ensure good contrast between photos and scanner background
- Lighting: Avoid shadows and reflections on the scanner glass
- Orientation: Photos can be in any orientation - adjust rotation in the app
scan-crop uses OpenCV computer vision to:
- Convert the scanned image to grayscale
- Apply binary thresholding using Otsu's method
- Clean up noise with morphological operations
- Find contours (outlines) of objects in the image
- Filter contours by size, aspect ratio, and dimensions
- Present detected regions in an interactive GUI for review and adjustment
- Apply rotations and export each photo as a high-quality JPEG (95% quality)
If you encounter errors related to OpenCV DLLs (especially "Invalid number of channels" or similar errors), the application includes diagnostic logging to help identify the issue.
To generate diagnostic logs:
-
Run the application with the
--debugflag:scan-crop.exe --debug path\to\image.jpg
-
A log file will be created in the same directory as the executable:
scan-crop-error-YYYYMMDD.log -
The log file contains:
- OpenCV version and installation path
- DLL files being used
- Python environment details
- System PATH information
- Full error stack traces
-
If the application crashes, diagnostic information is automatically logged
Common causes:
- Conflicting OpenCV installations on your system
- Missing or incompatible DLL files
- System environment variables pointing to wrong OpenCV versions
Solutions:
- Try running from a clean directory without other OpenCV installations in PATH
- Check the log file for DLL paths and ensure they match the packaged version
- Report the log file contents when filing a bug report
This project is free to use and modify.