photomosaic /

Filename Size Date modified Message
1.8 KB
1.3 KB
3.8 KB
876 B
12.8 KB



Prepare your image pool

  1. Collect a ton of images (2000 is a good number) for your image pool and place them in a directory (e.g. tiles/). Make sure they are the same size and w/h ratio*.
  2. Run $ python tiles/ to create the tiles database.

* use to "weed" out images with different ratios $ python tiles_dir desired_width desired_height weeded_tiles_dir This will put all images not matching desired_width and desired_height into weeded_tiles_dir so you can fix them later on and re-add them into the image pool.

Creating the mosaic

After running, you can now create mosaics. $ python [options] source_image.jpg output_image.jpg tiles_dir


  • -p RATIO: Ratio between the tile size and subdivisions of the image. Set to higher numbers for finer details. Use whole numbers only. e.g. A RATIO of 4 would place 4 tiles into 1 subdivision of the image. Default is 1.
  • -m METHOD, --method=METHOD: Traversing method. (inside-out or top-down) Determines where to start traversing the source image.
  • -r --repeat: Allow repeating of tiles
  • -n --norepeat: Do not allow repeating of tiles [default]
  • -t THRESHOLD, --threshold=THRESHOLD: Threshold value for comparing colors. Default is 0.
  • -v --verbose: Verbose output.
  • -x XSTART, --xStart=XSTART: X position of where to start matching. For inside-out method only.
  • -y YSTART, --yStart=YSTART: Y position of where to start matching. For inside-out method only.

Sample results and more info can be found on my website.