Skip to main content

Creating photo mosaics with Python

A photo mosaic is a picture that has been divided into tiled sections, each of which is replaced with another photograph that matches the target photo. When first viewed seems that it’s only one image, but a close examination reveals that the image is in fact made up of many hundreds or thousands of smaller images.

In general, those mosaics are created by computer applications, in this post you will learn how to create a photo mosaic generator using python.

The idea

Thanks to Dan Aldred and their great article about python photo mosaics, I’ve build an all-in-one, one step, mosaic generator, you only need to define the original image to be rendered, the output file and the image folder with original pictures (not thumbnailed) and voila!

Installing the software

I’m assuming that you are using Raspberry Pi or some debian-derivate linux distribution (like Ubuntu or Linux Mint) with python installed, but really, you can make it work with any linux flavour or any OS at all.

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install python-pip python-dev
sudo pip install -U pip
sudo apt-get install python-imaging
sudo pip install pymos

The code

Leave a Reply

%d bloggers like this: