| Tuesday July 29th 2014

Feedburner

Subscribe by email:

We promise not to spam/sell you.


Search Amazon deals:

Generate Awesome Photomosaics With Metapixel In Linux


Ok, I admit. I thrashed the Digg.com servers for a little while using an open source website mirroring tool named HTTrack.

About 30,000 user icons later, I present to you a product created by a couple very short and sweet command line tools.

digg.png

Here’s a another I generated, this HUGE image was scaled down from about 228 megapixels.

starry_night_mosaic.jpg WARNING: huge image.

So how can you make your own mosaic? Simple! Download and install metapixel, if you’re running Ubuntu, it’s located in the universe repository.

Then we are just a few commands away from generating sweet photomosaics. First, we prepare the images.

metapixel-prepare -r source destination --width=48 --height=48

This copies all images from the “source” folder, (recursively) searching into every folder within, and dumps every image it finds into the “destination” folder after resizing them into 48×48 pixel images. You’ll want to modify the width and height to fit the source images. This took a LONG time for me, since my library of images was so gigantic – but once we’re done preparing the images, you don’t have to do it again. Woohoo!

Next, we actually generate the output file(s) with this one liner:

metapixel --metapixel input.jpg output.png --library destination --scale=35 --distance=500

This takes input.jpg and increases the output size by 35 times (i.e. REALLY BIG IMAGE), uses the library destination and does not repeat any images found in the library closer than 500. It’ll spit output.png after a little while. If you don’t care about repeating images, removing the distance flag will result in MUCH, MUCH faster generation times.

Related Posts: On this day...

Leave a Reply

You must be logged in to post a comment.