What is it?
A mosaic is defined as, a picture or decoration made of small, usually colored pieces of inlaid stone, glass. Python can be used to create mosaics, not from glass or tile but from your images and photographs. A single picture created from and consisting of other tiny images. It sounds like it should be complex but, Python makes it easy with only nine lines of code!
1. Installing the Software
Installation is simple and requires a few Python Libraries. Before you get started make sure that your Raspberry Pi is up to date.
In the LX Terminal type:
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
2. Python Program
The Python code for creating the mosaics is also very simple and basically asks you for the image you wish to make into a mosaic, the name of the outputted file and the folder where all the images are stored and then the size and fuzz of the final image. The real skill is in choosing the most appropriate size, zoom and fuzz to make the final image look professional and like a mosaic! Open a new Python window, use the code below:
from pymos.core import build_mosaic
It really is this simple. Ensure that the program and the images files are stored in the same folder and then you are ready to create.
Ferran's awesome Mosic hack is here
Creating a Mosaic
3. Perfecting the Look
To create the perfect mosaic you will want to play around with the various settings in the code. The original quality of the images you are using and the colour variations required will all impact on the what the final image looks like. The first three elements set up which photo is the base of the mosaic, what the final image file will be called an also where the 'tile' images are stored.
The elements below can be altered and refined to make the final image look better. Using more tiles will make the image look better but each individual tile will lack detail.