Author: Nathan Willis
Photo mosaics are recreations of one large image composed of tiny tiles of other smaller images. They can be a fun project and make good use of the hundreds of less-than-extraordinary photos on your hard drive. We compared three easy-to-use Linux-based utilities for generating photo mosaics — Pixelize, Metapixel, and Imosaic — on speed, quality, and other factors.
Pixelize
Pixelize is the oldest of the three apps; it uses GTK1 for its interface, which may make it stand out from your other desktop applications. You won’t be able to use your favorite file selection widget, either, which can be frustrating — the GTK1 file selector does not remember the last directory you visited, and it does not provide thumbnail previews of image files.
You can download source code from the project’s Web page, but check your Linux distribution’s package management system first — many distros include Pixelize. The latest version is 0.9.2, and does not have any unusual package prerequisites.
The package includes two programs: the GUI front end pixelize, and the command-line back end make_db. You must run make_db at least once before you run pixelize in order to populate the database of source images from which the app will tile your mosaic. Just run make_db somedirectory/*, and make_db will index all of the image files within somedirectory. The utility cannot descend into other directories recursively, so you will have to execute make_db multiple times if you store your images in multiple locations.
Once you are ready, launch the GUI with pixelize &. Up will pop an empty window; choose File -> Open to select the picture from which you want to create a mosaic.
Choose Options -> Options to adjust the program’s parameters. You can specify either the number of images to use in each row and column of the mosaic, or the size to make each mosaic tile — changing either factor automatically adjusts the other. The only other option to worry about is the proximity of duplicates. If you have a very small set of source images, Pixelize will have to use each several times; this parameter allows you to space them further apart to make them less visible.
Once you are ready, choose Options -> Render, and Pixelize will generate your mosaic, drawing it on top of the original image in the main window. If you like what you see, choose File -> Save.
Metapixel
Metapixel is a command-line-only tool, but it offers more flexibility in mosaic creation than does Pixelize. The latest release is version 1.0.2, which you can download from the project’s site. Source code as well as Fedora RPMs are available. But as with Pixelize, many modern Linux distros ship Metapixel, so see if you can use an official package if you are not interested in compiling your own binary. Metapixel requires Perl for its image preparation step.
Before you can create a mosaic, you must run metapixel-prepare to prepare a batch of source images. The complete syntax is metapixel-prepare –width=n –height=m –recurse sourcedirectorydestinationdirectory. This will scan through sourcedirectory (recursively), and generate n-by-m tile images for each image it finds, saving them to destinationdirectory. The –recurse flag is optional, as are –width and –height; without them metapixel-prepare will create 128×128 tiles.
You can create a basic mosaic with metapixel –library=destinationdirectory –metapixel inputimage.jpgoutputimage.jpg. The –library flag should designate a directory of tiles preprocessed by metapixel-prepare; the ability to maintain multiple such directories allows you more flexibility in building your mosaics. Metapixel can generate JPEG or PNG output, depending on the output file name you provide.
Metapixel has several optional flags you can use to tweak the output. You can scale the output file in relation to the input with –scale=x, or assign different relative weights to the different color channels in the pattern-matching step. Collage mode (invoked with –collage) generates a mosaic where the tiles overlap each other, rather than being in strict rows and columns. There are even two different algorithms for determining which tile best matches which part of the mosaic, so you can experiment and decide what produces the best results for your input and tile collection.
Imosaic
Imosaic is the only closed source app in this mix. It is a .Net program that the author has also packaged for Linux and Mac OS X to run using Mono. You can download the latest package from imosaic.net. Unpack the archive anywhere on your system and launch the app with mono IMosaic.exe &.
I had trouble getting the software to run using Ubuntu 7.10’s Mono; even with all of the available mono* packages, Imosaic refused to run. I was able to get it working by downloading a vanilla Mono installer from the Mono Web site; luckily you can have more than one copy of Mono installed at any time.
Once you launch Imosaic, the first step to creating a mosaic is defining a collection of tile images. Choose Edit -> Images Collection from the menu, and in the Image Collection Editor, add as many files and directories as you need. To use your collection, you must explicitly choose Task -> Process images to prepare the tiles, then explicitly save the collection via File -> Save Collection. When you have a collection defined, you add it to the mosaic creation process under Imosaic’s Image’s Collections [sic] tab.
You select the image you want to transform into a mosaic with File -> Open Source Image. By default Imosaic displays grid lines over the image to show you where the mosaic tiles will fall, which is helpful. You can resize the tile dimensions in the Settings tab, as well as adjust factors like JPEG output quality and distance between duplicate tiles. When you are ready to convert, click the Process button and wait. The Statistics tab provides help info on the mosaic creation process.
The Linux and OS X port of Imosaic is recent, and that is reflected in UI quirks that take some getting used to. For instance, Windows naming conventions are used throughout the interface, such as My Computer and Personal — the latter of which refers to your home folder. I also encountered a lot of sudden crashes when trying to build image collections; after every three or four “Add directory” steps the app would blink out of existence, erasing all changes I had made to my in-progress collection. Until the developer fixes the problem, consider yourself warned and save those collections often.
Triptych
Side by side, it is hard to pick a best program from among the three apps. Metapixel offers far more mosaic creation options, but its lack of a GUI means you have to use trial and error to get a good feel for what those options do. I like how simple Pixelize is and how you can see your mosaic being generated as it happens on screen, but GTK1 is ugly and almost unusable nowadays.
Imosaic bests both of the others in a few important areas. It is the only program that integrates preprocessing an image collection (or even informs you in the interface that you need to preprocess a collection), and is the only one that allows you to cancel mosaic creation mid-process. But the Linux build is so buggy for now that it is hard to build a large enough collection to produce good output, and several of its key features (e.g. the Sequences tab) remain undocumented and are thus of unknown value.
As far as output quality goes, I was happiest with Metapixel’s results, using the –metric=wavelet and –search=global options. Pixelize tended to produce desaturated, nearly monochrome mosaics — and I have thousands of color images, so the problem is likely with the program’s algorithm. Imosaic produced respectable results, but the frequent crashes made it hard to build a large image collection with the variety needed to generate large mosaics.
A good GUI for Metapixel and some bug fixes for Imosaic would put them on approximately equal footing.
Finally, if you take an interest in photo mosaics, you might be interested to learn of the patent situation. Several patents on creating photo mosaics were granted to US-based Runaway Technology, beginning in 2000, despite apparent evidence of prior art dating back at least as far as 1993. It is unclear if the company has successfully defended its patents, but if your dreams include monetizing your mosaics, the inventions claimed in the patent are something you should look into.
Categories:
- Reviews
- Graphics & Multimedia