A quadtree recursively splits a 2D region into four equal quadrants. The
capacity setting determines how many pixels a leaf node can
hold before it subdivides. When a node is full, it splits — and each
quarter inherits the same capacity limit.
At high capacity, the tree barely subdivides: the whole image might fit in a handful of leaf nodes, each averaged to a single color — extreme compression. Lower capacity forces finer subdivision, letting colour-rich areas resolve to pixel-level detail.
Each leaf's colour is the RMS average of its pixels, which preserves perceptual brightness better than a linear mean. The animation steps from maximum compression down to the original image.