20 /
How string art generation works
String art draws a picture with straight lines only. One long thread runs from nail to nail around the edge of a frame, and where many threads cross, the picture gets darker. The string art generator has to work out which nail comes next, thousands of times in a row.
It turns your photo into a gray image, then works greedily: from the current nail it tries every nail it may go to, picks the line that covers the most of the dark areas that are still missing, subtracts that line from the image and moves on. Nails right next to the current one are skipped, because short threads along the rim add little but clutter. Everything runs in your browser; the photo is not uploaded.
The result is a numbered list of steps (nail 1 to 87, 87 to 12, and so on) and a preview of how the threads build up. Change the brightness, contrast, nails or number of threads and the order is worked out again in a few seconds.