- The "String Art" project is a forked version of an existing project.
- The "Dot Painting" project was coded by me.
- From the command line (HTTP):
$ git clone https://github.com/newtondotcom/string-art
$ cd string-artI would recommand using uv so
$ cd string-art
$ uv sync$ uv run stringart.pyIn string-art/main.py, you will find the following parameters:
IMG = "./images/zuko3.png"
DECOMPOSITION = False
NUMBER_LINES = 10000
NUMBER_POINTS = 360IMGrefers to the relative path of the image to use. In this example, it is thezuko3.pngimage located in theimagesfolder.DECOMPOSITIONis a parameter for creating videos. Setting it toTruewill create an image for each new woven line, which can then be assembled into a video using a video editing tool.NUMBER_LINESrepresents the number of lines to weave. The more lines, the more detailed and closer to reality the image will be, at the cost of increased execution time.NUMBER_POINTSrepresents the number of points on the outer circle. The more points there are, the more detailed the image will be, as the lines will follow the curves of the original image more closely.
$ cd dotpainting
$ go run main.goIn dotpainting/main.go, you will find the following parameters:
REGION_SIZE = 10
IMAGE_PATH = "../imagep/image.jpg"
OUTPUT_SVG_PATH = "../imagep/output.svg"
MAX_DOT_SIZE = REGION_SIZE
THRESHOLD_NO_DOT = MAX_DOT_SIZE / 10
A5_WIDTH = 148.5 // in mm
A5_HEIGHT = 210.0 // in mmIMAGE_PATHrefers to the relative path of the image to use.OUTPUT_SVG_PATHrefers to the relative path of the output file.REGION_SIZEis the size of the regions that will be used to calculate the average color. The smaller the region size, the more detailed the image will be, but the more dots will be needed to represent it. The larger the region size, the less detailed the image will be, but the fewer dots will be needed to represent itMAX_DOT_SIZEis the maximum size of the dots that will be used. This value changes depending on the region size and the image format, as the dots will need to vary in size to best represent the image.