In goes a photograph. Out comes the stained-glass panel of best fit — the closest window that can be built from flat pieces and lead.
or drop one anywhere · or paste from the clipboard
A stained-glass panel can only hold one flat colour per piece. Fix a way of cutting the panel and the windows you can build from it form a linear subspace: the functions that are constant on each piece. The panel closest to your photograph is that subspace’s orthogonal projection of it — and the projection has a closed form. On each piece it is simply the mean colour of the pixels underneath. No search, no iteration: the mean is the minimiser of the squared error, and we take it in CIELAB so “closest” means closest to the eye rather than closest in bytes.
That leaves one real decision — where to cut. The cut is fitted with SLIC: k-means in (L, a, b, x, y), which grows pieces that stop at colour boundaries while staying compact enough to actually cut. Turning regularity down lets the pieces chase edges; turning it up makes a glazier’s life easier. Pieces that end up in two disconnected islands are split and the slivers folded into their neighbours, because nobody can cut one piece that is in two places.
The leads are the cell boundaries, traced on the lattice of pixel corners into a planar graph, cut at every junction where three or more pieces meet, and simplified once per arc — so two neighbours can never round their shared edge differently and open a hairline crack between them. Straightness is that simplification tolerance, in pixels.
Choosing a palette is a second projection: onto the sheets a glazier can actually buy. The panel reports what that costs you, separately from the fit itself.
The residual view maps that error back onto the image: cool where the glass is honest, hot where a flat piece is telling a lie. It is the fastest way to see where more pieces would buy you something. The cartoon view is the glazier’s cut drawing — leads only, no colour.
Everything runs in your browser. No upload, no server, no account — the photograph never leaves the tab. Part of photo.mino.mobi.