How it works
No black box: here is what happens between your picture and the SVG.
In plain words
- 1
The app first finds the ink: the dark outlines a cartoon is drawn with. They become their own layer of smooth shapes, so lines stay crisp.
- 2
Then it looks at the colors behind the ink and groups pixels into areas that belong together — the sky, a cheek, a shadow — while soft shading stays one area instead of many stripes.
- 3
Each border between two areas is traced once and smoothed into curves, so neighbours fit together without gaps.
- 4
Finally every area gets its paint: a flat color, or a linear or round gradient when that explains the shading better. The result is drawn again and compared with your picture to give the similarity score.
For the technically curious
- Ink separation
- Color unmixing estimates, for each pixel, how much of it is ink: an alpha map traced at an upscaled resolution for sub-pixel accurate outlines.
- Planar map
- Areas come from an edge-preserving palette and a union-find merge guided by color distance (CIE ΔE) and how well one gradient explains the union.
- Shared boundaries
- Borders are chains in a planar map; every chain is fitted once with cubic Bézier curves and used by both areas, so there are no gaps or overlaps between neighbours.
- Gradients
- Per area, the best of flat, linear or elliptical radial gradient (three stops) is chosen by its render error.
- Compact SVG
- Relative path commands with the shortest number syntax — about half the size of absolute coordinates.
- Center lines
- Zhang–Suen thinning, a junction graph with spur pruning, and the same curve fitting, stroked with the measured ink width.