Quick manual cropping utility to grab 1:1 ratio sections from a folder of images
pip install opencv-python
Reading Video files requires ffmpeg.
Pass a folder of images or videos, or single files as a prameter:
cropper.py [OptionalArgs] Z:\\somefolder\\somewhere
cropper.py [OptionalArgs] Z:\\somefolder\\somewhere\\test.png
cropper.py [OptionalArgs] Z:\\somefolder\\somewhere\\test.mp4
or to shuffle:
cropper.py shuffle Z:\\somefolder\\somewhere
or to shuffle multiple folders:
cropper.py shuffle Z:\\somefolder\\somewhere Z:\\someotherfolder\\somewhere
Pass a folder of images as a prameter:
cropper.py [OptionalArgs] Z:\somefolder\somewhere
- Right Click or Space for next image.
- Mousewheel for resizing the box, Shift tot resize faster
- Left Click to capture the hilighted square
- Left Click and Drag to evenly spread a line of crops.
- Ctrl and Mousewheel Change the overlap of crops when dragging.
- B Skip to the next video during video frame cropping.
- A and D to go back and forwards in frame history
- R to rotate the image clockwise.
- SHUFFLE - Shuffle Images.
- ONECLICK - Jump to next image on every click.
- LARGESTFIRST - Sort files by size, largest to smallest.
- MAXCROP - Initialize on each image with the largest possible crop size.
- DARKENBG - Darken the unselected areas of the image in preview.
- WHOLEFRAME - don't crop, take the whole frame
- SLIDESHOW_TIMEOUT - timeout to skip to next image automatically
- SKIPTXT - Do not create caption .txt files
- NOSCALE - Do not scale final images down to TARGET_SIZExTARGET_SIZE
- NOIMAGES - Skip display of image files.
- NOVIDEO - Skip display of video frames.
- MAX_FILE_SIZE=N - Do not load files over N MB in size.
- TARGET_SIZE=N - Set the target dimension in pixels (Default 512)
- OUTDIR=DIR - Output to a directory called DIR ALLOW_SMALLER_CROP - Allow crops smaller than TARGET_SIZExTARGET_SIZE
- IFRAME_GAP=N - When cropping video frames, wait at least N seconds between Key frames (Default 10).
- VIDEO_START=N - When cropping video frames, Sart this many seconds or HH:MM:SS into the video
- FRAME_FWD_CACHE=N - The maximum number of bytes to use for a forward frame cache when cropping video frames (Default 1GB).
- FRAME_HIST_CACHE=N - The maximum number of bytes to use to keep images in history so they can be skipped back to (Default 1GB).
images are saved into .\outdir\
ffmpeg
Pass one or more video files a parameter:
getframes.py Z:\\somefolder\\video1.mp4
will extract a frame once every 60 seconds. and place it in the '.\frames' directory