Photo Mosaics 

December 22nd, 2007

There are times when you find something that you find interesting if for no other reason then its different. That is the case when I stumbled upon a program called Metapixel. It is an opensource program, available for different Linux distros (it is in the repositories if you are running Ubuntu), and basically it takes your pictures and creates a mosaic out of them. So what does that mean? It means that it takes all your pictures, in our case that is around 7000 different pictures, and creates miniature versions of those pictures, as part of the preparation phase. It then takes the “library” created and uses them to create a mosaic out of your input picture.

Clear as mud?

I’m sure this means NOTHING to most people, but for those one or two people that this would actually be something they’d like to try, I’ll go through the steps.

Above and beyond everything else, of course you’ll have to have metapixel installed and in your path. I normally run Ubuntu, on different machines, so I just added it via the repositories.

First, we need to prepare all your pictures. This will not touch your originals, other then reading them in, so fear not. You’ll designate your input directory and your output directory:

metapixel-prepare -r /source_directory /destination_directory --width=30 --height=30

This can take some time, depending on the number of pictures you have in your library. The one positive is that you’ll only have to do it one time, regardless of how many mosaics you end up creating.

Second, once the library creation is completed, we’ll now need to determine what image we want to create the mosaic of. I recommend images that are in bright light, just from my testing; the dark pictures tend to show up with some strange colors. Once you have determined what you want to create the mosaic of, it’s time to kick off the second step of the process.

metapixel --metapixel /source_directory/input_picture.jpg /destination_directory/output.png --library /destination_directory --scale=8 --distance=50

What this does is take your input_picture.jpg and create the output.png file as your mosaic. It uses the images from the destination_directory, which you created the previous step. The scale directive is stating how big of an image to create, depending on how big your input image is; in this case we are creating an image that is 8X bigger then the original. Be careful, I got carried away the first time and it created a HUGE file that you cannot do anything with. If you input file is 1MB, your output file will roughly be 250+ MB. The distance parameter indicates the minimal number of pictures between the first usage of the image and the second; there will be 50 different images between the first use of an image and the next time the image will be used in the mosaic. The larger the distance, the longer it’ll take to create the final output. If you do not care about the distance, remove it completely to speed up the process considerably. Depending on the speed of your machine, the scale you’ve set and the distance set, this could take a while.

So what do you get out of it? Here is an example of a mosaic I created (clink on the image to see the full size):

I had to reduce the image WAY down as you’d never be able to open up a 266MB file; well not quickly anyway. Obviously reducing the image size also reduces the ability to zoom in and see the images used to create the mosaic, but zooming in on the larger image and you’ll start to see the individual images.

The usage is where the question comes in; what exactly do you do with something like this? Depends. My thought was to take and build a library of sports images and create a mosaic of something like Arrowhead Stadium or Kaufman Stadium, at which time I’d have it professionally printed and framed at the larger size. First I have to build the library, which could take some time.

So the challenge now is for you to create one and share your work.

Leave a Reply

You must be logged in to post a comment.



Joomla Template by Joomlashack
Joomla Templates by JoomlaShack Joomla Templates by Compass Design