This is a recreation of Damien Hirst's Spot Painting using Python with the help of the Turtle module.
We are going to create this colourful piece of art which sold for more than half a million pounds ! (25 random colored dots) just by using the well-known turtle module present in the python library.
-
Familiar with the Turtle module (Don't know? Internet is the savior. Trust me it's easy ๐).
-
Installation of the Colorgram Package (We need to make our painting as colorful as Damien Hirst's ๐).
-
Basic comprehension of the RGB color system ๐งฎ.
-
We start by downloading a spot painting image, which we use to extract the colors using the colorgram package.
-
We run a for loop that taps into each of the colors, and extracts the red(r), green(g) and blue(b) colors.
-
Further we initiate a tuple that holds (r, g, b) and append the tuples into an empty list.
-
Lastly, we copy & paste the entire output list into our main.py and comment out the prior code (we don't need to run the computation every single time when our goal is to just extract the colors).
Now while we are using our color_list, there are chances that the first few tuples lead to white (the background color from the image), which might be unnecessary.We can go ahead and test our color tuples & remove the desired.
-
We intend on drawing a spot painting 10 X 10 in size, with each dot of size 20 and spaced apart by 50 paces.
-
We use the dot() to draw the dots and colormode(255) to access and generate random RGB colors.
- Inorder to prevent the turtle to start from the center and move out of the frame, we play around with setheading() & forward() to move the turtle to the intended position.
- We then add more codes to the for loop to make the turtle move to the next row and start from the front & keep moving further drawing dots.
- Lastly, we can increase the speed of our turtle by using speed(), make the forward lines vanish by using penup() (this doesn't affect our dots!) and make the turtle invisible by using hideturtle().
-
How amazing the turtle module is! ๐ข
-
How expensive contemporary art can be! ๐