We’ve all been there — through the magic of the internet, you see someone else’s stunning project and you just have to replicate it. For [Jenny Ma], that project was computer-generated string art, as in the computer figures out the best nail order to replicate a given image, and you lay out the thread yourself.
So, how does it work? Although a few algorithms are out there already, [Jenny] wanted to make her own using Python. Essentially it crops the image into a circle and then lays out evenly-spaced software nails around the circumference. The algorithm starts from a random nail and then determines the best next nail to wrap around by drawing a line from that nail to every other nail and choosing the darkest one based on the darkness of the image underneath that little line. It repeats this one chord at a time, subtracting from the original image until every pixel has been replaced with a thread or lack thereof, and then it spits out an ordered list of nail numbers.
Once the software was ready, [Jenny] made a wood canvas that’s 80 cm (31.5″) in diameter and started laying out the nail hole locations. There wasn’t quite enough room for 300 nails, so instead of starting over, [Jenny] changed the algorithm to use 298 nails and re-ran it.
[Jenny] does a great job of discussing the many variables at play in this hardware representation of software-created art. The most obvious of course is that the more nails used, the higher the resolution would be, but she determined that 300 is the sweet spot — more than that, and the resolution doesn’t really improve. We have to wonder if 360 nails would make things any easier. Check out the build video after the break.
Want to cut out most of the manual labor altogether? Build yourself a string art machine.
What a great project, it came out fantastic. Thank you for explaining how this was done. This is a real cool math -art- computer programming project. thank you for sharing.
This is an amazing project, from conception through implementation to the final product. What a great combination of code, hardware, and aesthetics.
Upon seeing this, my first thought was, how could you get a spider to run the pattern?
Kind of looks like you had a trained spider do the leg work and then shook carbon or toner over the web afterwards.
It also makes me wonder how long you could have the nails before they tend to bend too much. Some offset in the “layers” and see what the shadows do as the light moves.
Then that leads me to the idea of an outdoor one on the scale of a corral.
Use tall poles like a batting cage. Bonus points for making it work as a sundial also.
lol. Can you tell that I like the project?
Amazing work.
Two thoughts for automation that are less extreme than the linked CNS machine:
1) create an annulus with LEDs corresponding to the nail positions, and light up the next LED on cue to aim the next thread
2) have a rotary table that can index under stepper/geared control, to bring the next nail to you, with suitable thread tensioning facilities
Why stop there? Add color!
String Art Machine
https://www.youtube.com/watch?v=G5w9RcCLTXs
Interesting project and beautiful art.
Something about this reminds me of CT scanners and the algorithms used to construct image slices.
In essence they are similar tasks, both express an image, related to density, as expressed with straight lines, though one goes from (an x-ray) thread to an image, while the other translates an image to (polyester) threads.
I was thinking the same thing, in that it is a kind of reverse computed tomography, but the difference is that beams can go through a pair of points on the perimeter that are not diametrically opposite, unlike the beam in a CT scanner, which rotates around and passes through the centre.
I think it could work with only threads that go through the center, the main problem being that each thread needs to be a different thickness or transparency.
I think the author did come across the Hough transform, **the** classic image processing algorithm to answer the question “if I were to represent an image through straight lines, what’s the least-error method of doing so”, from 1959 (it’s really classic, I think it’s typical intro-textbook level material to image processing): https://en.wikipedia.org/wiki/Hough_transform
Sure, there’s research papers on applying that specifically to string art (most of them aren’t *that* good), but the algorithm is simple enough and very close to what she’s doing. If she didn’t stumble across the Hough transform: Kudos, it’s a clever thing to do, and her execution is nice!
@Marcus Thanks for introducing the Hough Transform. I read the Wiki article and I think I understand it. However, I am not able to see how to use that algorithm (in the modern form) to the string-art problem. Help?
@Marcus Thanks for introducing the Hough transform. I read the wiki article and I think I understand it. However, I am not able to see how to apply that to the string-art problem. Help?
I wonder if one could just feed the thread through the nozzle of a 3D printer, and reuse it for this. Though many printers are a bit on the small side for this purpose.
3D printers are rather good at making lines of plastic string when wrongly configured, maybe you could actually use the stringing effects to do this with plastic?
Actually, why thread? Use a filament / settings prone to stringing ;)
Beautiful work.
Here’s an idea: Do this with a negative of the picture you want, then display it using a Vectrex-like (or early Atari vector-based game engine -like) display. I realize that drawing thousands of vectors would not likely be flicker-free, but let’s call that a feature, since the image would be constantly changing, while integrating in our vision to the desired image.
Here’s another idea: instead of thread, use Kapton tape, like around 10mm wide. Then you CAN use the transparency of the “thread”, and it would certainly make a difference.
something like this:
https://www.fancybeast.de/mark-khaisman-contemporary-tape-art/
Similar, but that’s cheated – most of the tape strips don’t run the whole length.
I’m patient and can do very tedious things. But that’s a lot of string. Bravo. I wonder what effect backlighting could have, might increase the contrast.
Not a hack, interesting in a limited sort of way but that is all. Not sure how I feel about people ripping off existing artists, they usually have a tough enough life as it is.
I personally do not think this is about ripping people off. Petros Vrellis, the artist she is referring to, seems like a pioneer to me in this kind of art. And he inspired many people to give this one a try for themselves (including me). Nice to see that also other managed to figure out an algorithm to create such art.
For anyone who is interested, see here the website of Petros Vrellis: http://artof01.com/vrellis/
I have also posted this kind of art as a DIY-Project on Instructables last year: https://www.instructables.com/DIY-String-Art-the-Lion/
Video: https://www.youtube.com/watch?v=DtrYdr4ktvI
Intent and effect are two seperate things. I’d be more inclined to call it a hack if the code would work with any closed shape and or allowed tricks such as two strings being able to form a twist that allowed X lines to form. Genuine innovation.
I would also have used the thickness of the nails in the algorithm. That doubles the “resolution” without any extra work. It would just spit out if you have to wrap the thread clockwise or counter clockwise around the nail.
In addition to taking into account the thickness of the nail (and therefore determining which ‘side’ of the nail to land on), I wonder if it also matters whether the ‘target nail’ is ‘straight ahead’ (across the center of the board from ‘current nail’) vs at a sharp angle. The thread is resting on a curved cylinder (the nail) and I wonder if the departure point – which is dictated by the angle of the thread – could affect the accuracy. Would be fun to figure this out!
Hi, im from colombia, my english isnt the best, but i need the algorithm, this is string art or in spanish “hilorama” i make those things in my free time, i wanna do this type of portraits but i need the algorithm, do you even know wera i can found it?
I don’t think there‘s a thing like „the algorithm“. Only people, who tried and developed their own ones.
But I found a post on hackaday.io where such a software was given for download.
https://hackaday.io/project/130951-diy-knit-portrait
Never tried this out, so I can’t say anything about the quality or how good this algorithm actually works.
Interesting that there is a ready-to-use-software. But i would be much more interested about AN ALGORITHM.
a semi-automatic way to weaving
https://circuit4us.medium.com/neopixel-assisted-string-art-weaving-9c34a169b18a