Quadtrees for the web, inspired by quad by Leon Rische; see Quadtree Grammars.

a | b |

d | c |

Here's how it works: We define rules. The rule have numbers. The first rule has the number 1. There can be up to nine rules (numbers 1 to 9). Each rule has four statements, one statement per quadrant. The canvas is divided into four quadrants, a, b, c, and d, clockwise (e is the colour to use when the limit of one pixel is reached). A statement can assign a colour (white, black, red, etc.), or a rule number to a quadrant (1, 2, 3). Thus, the rule "1a white" means that the top left quadrant of the canvas is white. The rule "1c 1" means that the bottom right quadrant is to be filled using rule number 1. That in turns means that its top left quadrant is white, and that it's bottom right quadrant is to be filled using rule number 1. And thus there is a recursion.

Click the 4K PNG button to generate a download link. Click the link to see the rendered image at 4096×4096 pixels. If clicking doesn't work, then right-click the link and choose to open it in a new tab instead.