Photomosaic pictures with Metapixel

Install metapixel

mosaic of a woman
Ubuntu/Debian:

$ sudo apt-get install metapixel

Fedora/CentOS

$ sudo yum install metapixel

Put all the images you want to use in a directory, or a set of directories so you can prepare them as tiles. The Pictures directory under your home directory might be a good place to start.
Create a set of tiles for Metapixel to use for the mosiac.

$ mkdir tiles
$ metapixel-prepare -r ~/Pictures ./tiles –width=24 –height=24

Using an image you want the mosaic to look like overall, and at least one tile library directory, create the mosaic. If you have multiple library directories, specify them one after the other with -l or –library. You can also use collage mode, -c or –collage, which will allow the tiles to overlap each other, but this will take longer to compute and may or may not look as crisp.

Generate the mosiac out of the individual tiles

$ metapixel –metapixel ~/Pictures/vangogh.jpg –library=./tiles mosaic.png

If the image doesn’t look like the original vangogh you based it on, try adding scale so it can use more images or shrink the tiles to something smaller than 24×24.

If you see the same pattern repeating too often, try specifying a minimum distance between cells for repeating an image.

Error: cannot find a matching image – try using a shorter minimum distance.

If it can’t find replacements for the optimal images it was going to use, it will complain. In this case, just keep incrementing the distance until it completes.

Pictures with great detail or little contrast require larger canvases. Simple clipart works well with less tiles. Try making one out of famous paintings, abstracts or pointillist work well, like this one by Paul Signac.

$ metapixel –metapixel paul-signac_portrait-felix-feneon.jpg -l ./tiles/ -l ./tiles2/ -l ./tiles3/ –scale=15 –distance=3 output.png

This was made with 3 directories full of images and the canvas scaled 15x as large as the original jpeg. The full mosaic is really large.

$ identify output.png
output.png PNG 11584×9280 11584×9280+0+0 8-bit DirectClass 54.2mb

Leave a Reply

Your email address will not be published. Required fields are marked *