Skip to content

abhishekaudupa/computational-string-art

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Art Generation Algorithm

Copyright 2024 Abhishek A Udupa

This is a simple string-art generation algorithm I made with basic knowledge of mathematics and computer graphics and implemented using the C programming language, from scratch. I made a series of videos on YouTube explaining the process in detail and the code in this repository stays true to that tutorial.

string-art-representative

What's here?

There are a couple of C files in the main directory and the archive corresponding to various YouTube videos in the series.

1. Grayscale Converter

The code in archive/grayscale.c converts a given color BMP image to grayscale BMP image of the same size. I've explained it in detail here.

2. Blank Image Generator

The code in archive/canvas_maker.c takes an input BMP image and spits out another BMP image that is completely whitewashed. This corresponds to the this video.

3. Thread and Nail Generator

The code in archive/thread-generator.c takes an input BMP image (of same width and height. The program doesn't check this though) and generates another BMP image of the same size which has all possible threads strung between all possible nail-pairs. This file has various functions whose working is explained in details in part-2, part-3 and part-4 of the series.

4. The String Art Generator

The code in string-art.c is of our primary interest as it contains the algorithm for generating the string art. This takes a BMP input image (of equal width and height) and outputs its string art representation. This file corresponds to this video, in which I've given a thorough explanation of its working.

This part is still a work in-progress: I'm yet to show how to optimize the program and to make it converge faster and better. I'm planning to do that in part-6.

More Info

None of the programs in this repo follow safe programming techniques such as bounds checking, null checking etc and will crash upon encountering unexpected inputs (if you do not pass the name of the image as an argument, for example). Since I've wrote these programs with the intent to demonstrate the working of the algorithm, I did not bother writing secure code. If you're planning to use this in an unsafe environment, I highly suggest you fortify your programs.

About

Computational String Art Generation Algorithm, from first principles.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages