It's a simple Python tool to quickly create a slideshow from photos with zoom and shift effects.
Initially, it was created to crop images to a certain ratio, but then progressed to something bigger.
- Clone the repository and navigate to the cloned directory.
git clone https://github.com/mkulik05/photos_cropper.git
cd photos_cropper
- Install
opencv
and'screeninfo' libraries:
There are several hardcoded values in code, such as:
- FPS
- Seconds for each frame in the slideshow
- Backup file name
- Video output file name
- Duration of fade-in and fade-out effects between two images
- Way to sort files: either by date or as usual strings
After starting, you will be asked several questions, which are really intuitive. Then the main working window will appear. It will contain the current image you are working on and a drawn rectangle that is the image part that will be used in the video. All interaction is done through the keyboard.
Here are all the keys required for work:
w
,a
,s
,d
moves rectablef
andc
centers selection rectangle according to image center vertically and horizontally, respectively.- 'm' and
n
increase and decrease rectangle move step x
andz
increase and decrease the size of the rectangle, saving its aspect ratio.e
saves the keyframe. You need two keyframes to get the zoom/shift effect. Use the selection rectangle to select the image area. A smooth transition between two keyframes will be created in the video.esc
stops program
After selecting second keyframe, a preview window will be opened showing the result effect. Press y
to save it and get to the next photo, or use any other key to return to this photo (note that keyframes will be cleared).
A backup file is used to save image parameters, keyframes, and so on. It allows you to recover your progress or quickly add new photos (when you load a backup file, only newly added photos will need processing).