Quad Tree Images

art kotiln

This art form recursively partitions an image into quadrants, towards lower entropy.

The project is maintained on GitHub: here.


  1. Partition the image into four quadrants.
  2. Color each quadrant based on the average color of the pixels in the target image.
  3. Compute each quadrant's squared error between the original target image and the generated image.
  4. Select the quadrant with the highest error and recur into it.
  5. Repeat from step one, using the current highest error quadrant.


  • To avoid local minima, and/or force the algorithm to focus on areas of high entropy, there is a randomness variable (0 - 100%) to help the algorithm generate "better" results. The default value is 5%.
  • In order to have well defined grid lines, it is recommended to use an image with dimensions that are power of 2. (Squares are not required, 512x256, is also perfectly ok.)
  • Algorithm inspired by Michael Fogleman's post.


My Profile picture. (left: original, middle: without grid borders, right: with grid borders)