Repository navigation
A big cleanup of the batch cropper: it installs with pip, fixes the crashes people hit, and lets you fine-tune the box before anything gets cropped.
Install
pip install "git+https://github.com/NatLee/batch-crop-images@v2.0.0"
batch-crop --input_path ./photos --output_path ./croppedpython main.py --input_path … --output_path … from a clone still works, with the same default folders and JPEG quality 95.
Two changes you'll notice
- Releasing the mouse no longer crops straight away. Adjust the box, then press Enter (or Space, or double-click inside the box) to crop the batch. That's why this is 2.0.0.
- A missing input folder now exits with code 2 instead of 255, like every other usage error.
Fixed
- Dragging a box from right to left produced an empty crop and crashed (#2).
qnever actually quit.- Upper-case
.JPGfiles were ignored, and a folder with only those crashed. - Nested output folders weren't created.
- It didn't start on systems without Tk.
- On Windows, paths with non-ASCII characters couldn't be read; transparency, EXIF and ICC profiles were dropped.
- "The first image" wasn't picked in sorted order.
New in the cropping window
- Drag the box to move it, drag its corners to resize.
- Arrow keys nudge by a pixel,
Elets you type exact numbers,Rlocks the aspect ratio (or start with--aspect). +/-zoom, and the window can be resized.
New on the command line
--box,--save-preset,--preset: re-run the same crop without opening the window.--mismatch stretch|scale|anchor|skipfor images of a different size. The default still asks per image, but now asks everything before writing a single file.--recursive,--dry-run,--skip-existing,--jobs, and a progress bar.
Linux tip: OpenCV's window on Linux zooms with the mouse wheel by itself and then left-drag pans, which fights with drawing the box — use + / - to zoom instead.
Tested on Linux, Windows and macOS with Python 3.10 and 3.14.