I wanted to create bookcover collages like this to share with my friends. This Python script helps you create same beautiful collages from your images. It’s simple to use and works with common image formats like JPG, PNG, and more.
Pillow
library (for image processing). The script will guide you to install it if needed.Prepare Your Images
Keep all images from which you want to make collage in a single new folder. nothing else in that folder.
Save the Script
Now save this script and move it into the above folder of images. ctrl+s
shortcut.
Open a Terminal or Command Prompt
In the same folder, you can open a terminal or command prompt window.
or open command prompt and Navigate to our folder containing collage_gen.py
. use the commands like cd
or chdir
to navigate.
Run the Script
Use the following commands now to create a collage:
python collage_gen.py
or python collage_gen.py -c 7
to adjust columns
TIP: Rename the images as 01, 02, … in order for deciding the order in final collage. Make sure to not disturb the file extensions part while renaming (file extensions are .jpg, .png, …)
For more advanced usage pass other options
python collage_gen.py --columns 3 --input-dir "my_images" --output "my_collage.jpg" --width 400 --height 600 --padding 15 --background "black"
Enjoy creating your collages! 🎉