Wednesday, 25 February 2009

Every pixel tells a story

Recently the Daily Daniel ran a story (hark at me! I'm not The Times!) with a single photograph - a mosaic - each 'pixel' containing a separate photo. I've finally got round to explaining how it is done, if only to show that I didn't arrange the pictures manually - she is beautiful, admittedly, but I gotta work to eat!

Right, the Linux program is called 'metapixel' and is downloaded from here. If you've enough photographs, you can produce some incredible results

You need to issue 2 commands - one prepares the photos, then the other makes a mosaic out of them. Create a folder somewhere to store the prepared photos called, say, 'recast'

$ metapixel-preparee -r /directory/where/photos/are /directory/recast --width=40 --height=40

The larger the width and height, the longer it takes. Be sure to get the aspect ratio of the photos right - it doesnt check or automatically correct. Choose a single photo that you want to make a mosaic out of (e.g. /directory/in.png), then (be warned, this may/will take several hours for a big photo!):

$ metapixel /directory/in.png --library /directory/recast --scale=5 --distance=5

The scale tells it how big you want the output (i.e. here 5 x size of input image), and the distance tells it how far to look for matches - it matches by colour so its a really good idea to scale by the range of inputs. It will give you an error if the distance parameter is too large. The results can be mixed, but once you hone the inputs and parameters down, and you have a LOT of patience, you can get some really great mosaics!

No comments: