Get the latest news and tutorials on open source to improve yourself as a hacker.

Post Top Ad

Operating Systems


Post Top Ad

Being an open source lover, I decided to give a try to a photo collage creator which I did find on Github. Impressed by the results of the tool, I thought it would be a good idea to share it with python users.

Download and setup the tool on your local environment

First of all, go on Github and do a clone of the repository or download it as a zip file. I prefer using the following command to clone the official repository on my local machine.
git clone
Once you have managed to download the project on your computer, navigate to the root directory with the help of the terminal; so you can make usage of the script.
cd collage_maker
Create a virtual environment inside the project's root directory by making use of the python 2.7.x and install the pillow library as it is required by the tool for the image processing.
virtualenv -p /usr/bin/python2.7 env
source env/bin/activate
pip install pillow

Generate your first photo collage

The tool is simple to use. Having a very clear documentation on its command line interface, the options are self explanatory.
Once you have managed to navigate to the root directory of the project; create a directory with the whole photos which you want to include in the collage. Just make sure to remember its absolute path so you can use it later inside the tool.

Personally, I like to keep the directory with the photos on my Desktop. The following is its absolute path.
The options which you need in order to generate the photo collage are being shown below.
-f the full path of the directory with the photos
-o the photo in the output, usually in .png
-w width of the photo in the output
-i height of the photo in the output
Then run the following command on the terminal while being inside the project's root.
python -f /Users/oltjano/Desktop/collage -w 800 -i 250 -o /Users/oltjano/Desktop/photo_collage.png
The following is the output on my case.
Having tried many various parameters for the -w and -i, the ones being shared above fit the best. Another option which seems useful to me is the -s. It helps to shuffle the images in the collage.
python -f /Users/oltjano/Desktop/collage -s -w 800 -i 250 -o /Users/oltjano/Desktop/photo_collage.png

No comments:

Post a Comment

Post Top Ad