← Back to list

PYTHON Made Me Recreate a Painting That Sells for Thousands of Dollars.

Day 18 of 100 Days of Code — Turtle Graphics & The Hirst Painting Damien Hirst is a British artist. He makes large canvases of colorful…

Sadiq Usman · 2026-05-13 11:45 · 0 claps · 2.2 min read
#python-programming #100daysofcode #software-development #learning-to-code #codingbootcamp
Open on Medium ↗
Wiki topics: TLS · Design Tools & Workflow EDU · Education & Learning 💻 · Programming 🎨 · Fine Art

PYTHON Made Me Recreate a Painting That Sells for Thousands of Dollars.

Day 18 of 100 Days of Code — Turtle Graphics & The Hirst Painting

Damien Hirst is a British artist. He makes large canvases of colorful dots — no pattern, just rows of randomly colored circles. Simple idea. Those paintings sell for hundreds of thousands of dollars. Day 18 of the course had me recreate one with Python. Programmatically. Using a turtle. I’m not sure how to feel about that. The Setup Before the main project, there were some smaller turtle exercises — drawing polygons, dashed lines, and a spirograph using loops and RGB colors. I’d touched the spirograph logic on Day 17, but here it came back with more structure. Drawing ten different shapes in sequence, each with a different angle calculation. That part clicked faster the second time. Then came the Hirst Painting. The colorgram Library The first step was extracting colors from an actual Damien Hirst painting image. Angela introduced a third-party library called colorgram for this. You install it with pip, pass it an image file, and it returns the most dominant colors as objects.

import colorgram

colors = colorgram.extract("image.jpg", 30)
rgb_colors = []

for color in colors:
    r = color.rgb.r
    g = color.rgb.g
    b = color.rgb.b
    rgb_colors.append((r, g, b))

This was the first time I used a library to actually process a file. Not just install it and call a function — but feed it real input and get meaningful data back. Small thing, but it felt more like real programming than most things I’ve done so far. Drawing the Painting Once I had the color list, the turtle draws a 10x10 grid of dots — each one picking a random color from the extracted list, spaced 50 pixels apart. The positioning logic requires moving the turtle to the bottom-left corner first, then drawing row by row.

from turtle import Turtle, Screen
import random

tim = Turtle()
screen = Screen()
screen.colormode(255)

tim.penup()
tim.hideturtle()
tim.setheading(225)
tim.forward(300)
tim.setheading(0)
tim.speed("fastest")

for _ in range(10):
    for _ in range(10):
        tim.dot(20, random.choice(color_list))
        tim.forward(50)
    tim.setheading(90)
    tim.forward(50)
    tim.setheading(180)
    tim.forward(500)
    tim.setheading(0)

screen.exitonclick()

When it finished rendering I just looked at it for a second. A grid of colorful dots pulled from an actual painting, drawn by a turtle cursor I controlled with a loop. It looks like art. It took maybe 30 lines of code. What Got Me The setheading() positioning logic was the part I had to think through the most. Moving the turtle to the corner before starting, then resetting its direction after each row — I misunderstood it on the first try and got dots overlapping on the same row. Re-reading the logic slowly fixed it, but it was one of those bugs where nothing looks wrong until you trace through the movement step by step. Also: tuples. The RGB colors are stored as tuples — (r, g, b) — and you can’t modify them. Day 18 is where I properly understood why tuples exist as a separate type from lists. Some data just shouldn’t be changed. Day 18 done. The painting ran. Damien Hirst probably didn’t notice.


메타데이터
post_id
737bba2e8f71
slug
python-made-me-recreate-a-painting-that-sells-for-thousands-of-dollars-737bba2e8f71
url
https://medium.com/@sadiqnagoda1848/python-made-me-recreate-a-painting-that-sells-for-thousands-of-dollars-737bba2e8f71
canonical_url
https://medium.com/@sadiqnagoda1848/python-made-me-recreate-a-painting-that-sells-for-thousands-of-dollars-737bba2e8f71
author_url
https://medium.com/@sadiqnagoda1848
status
ok
fetched_at
2026-06-09 15:37:30