Photographic mosaic is a technique of re-generating an existing image as a mosaic of thumbnails. The color of the original pixels should roughly resemble the color of the covering tile.
For example, a role-playing gamer re-generated the world map from thumbnail images of users.
The source code for this image is shared on github, but it's pretty tailored for the specific world-map task.
Is there a general solution for re-generating an existing image as a collage/mosaic of a set of given thumbnails?
Proof of concept follows, as a simple
bash
script with ImageMagick to do the image processing work.I don't have an endless supply of thumbnails but the concept seems to work. The maths of distance between colours is done in
awk
and obviously could be done in a more perceptually uniform colorspace and also things could be speeded up considerably. Another thought, to avoid repetition, might be to bin the tiles into similar colours and then take one at random from the nearest bin rather than the absolute nearest one.The file
tiles.txt
looks like this: