Close Menu
    Trending
    • Optimizing Data Transfer in Distributed AI/ML Training Workloads
    • Achieving 5x Agentic Coding Performance with Few-Shot Prompting
    • Why the Sophistication of Your Prompt Correlates Almost Perfectly with the Sophistication of the Response, as Research by Anthropic Found
    • From Transactions to Trends: Predict When a Customer Is About to Stop Buying
    • America’s coming war over AI regulation
    • “Dr. Google” had its issues. Can ChatGPT Health do better?
    • Evaluating Multi-Step LLM-Generated Content: Why Customer Journeys Require Structural Metrics
    • Why SaaS Product Management Is the Best Domain for Data-Driven Professionals in 2026
    ProfitlyAI
    • Home
    • Latest News
    • AI Technology
    • Latest AI Innovations
    • AI Tools & Technologies
    • Artificial Intelligence
    ProfitlyAI
    Home » Generating Artwork in Python Inspired by Hirst’s Million-Dollar Spots Painting
    Artificial Intelligence

    Generating Artwork in Python Inspired by Hirst’s Million-Dollar Spots Painting

    ProfitlyAIBy ProfitlyAIDecember 18, 2025No Comments7 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    been to an artwork museum and puzzled how such a seemingly unusual piece of artwork can get so well-known or be bought at such a excessive worth? Or how paintings that appears really easy to make with such fundamental strategies could also be so revered and entice an enormous crowd of bidders? Such is the case with Hirst’s spot work.

    Damien Hirst is an English artist well-known for his up to date artwork on life, demise, and sweetness. His well-known spot work embody stuffed circles of various colours organized in a grid type with a light-weight coloured background. These work, though so plain and easy, have been bought at auctions for as much as a million dollars!

    On this article, we’ll use Python’s colorgram and turtle module to create spot work, inspiration from Hirst’s shade palette and strategies. It is a beginner-friendly Python tutorial however requires a fundamental information of Python fundamentals, in addition to creating objects and utilizing strategies, and importing and utilizing Python modules. By this enjoyable and fascinating Python tutorial, we’ll be taught to implement the idea of OOP in programming in addition to find out how we are able to get our goal fulfilled utilizing modules and just some traces of code.

    Let’s awaken the artist inside us whereas we be taught Python coding!

    Spot Work

    Hirst’s spot work embody small spots of varied colours aligned in a grid type. The work are distinctive of their variety of dots, in addition to the colour palette utilized in these work. We are going to use Python’s colorgram module in an effort to extract the colour palette from these so revered work, after which use Python’s turtle module to attract these spots within the type of a grid. We are able to specify the variety of dots on our canvas, in addition to the space between them, and the colour scheme used.

    For reference, take into account checking these work via this link.

    Extracting Colours

    The very first thing is to extract a shade palette from considered one of Hirst’s work. We are going to obtain the portray into the identical listing because the Python file by which we’re writing our program. However first, allow us to set up the colorgram module by writing the next command traces into the terminal:

    pip set up colorgram.py

    Subsequent, we’ll import the colorgram module into our code and use the extract perform, whereas specifying the picture file and the variety of colours we wish to extract from the reference picture as arguments to the extract perform. Here is the picture file I’ve downloaded as “ref.jpg” and used to outline the colour palette of my Python-generated spot portray.

    import colorgram
    colours = colorgram.extract("ref.jpg",20)
    print(colours)

    After we run the above traces of code, it would print out 20 colours which are current within the reference picture:

    Colours Extracted from the Reference Picture (Picture by Writer)

    Discover that the colours extracted above are in a distinct format than is suitable with the turtle module. We are going to now flip these colours into turtle-compatible colours.

    Creating the Colour Checklist

    First, we’ll create an empty listing and append the extracted colours one after the other after correct formatting into RGB format. We are going to faucet into every of the r, g, and b values of the extracted colours and retailer them in our created listing with acceptable formatting. For this goal, we’ll use the for loop:

    rgb_colors = []
    for shade in colours:
        r = shade.rgb.r
        g = shade.rgb.g
        b = shade.rgb.b
        new_color = (r, g, b)
        rgb_colors.append(new_color)
    print(rgb_colors)
    Colours in RGB Format (Picture by Writer)

    As may be seen from the above picture, the RGB colours have been correctly formatted and might now be utilized forward in randomly deciding on the dot colours.

    Importing Turtle and Configuring Fundamental Settings

    Now, we’ll import the Python turtle module to create our paintings. We are going to outline the fundamental settings of our turtle. The primary is the colormode(), which is able to determine how we’ll use the colours in our code forward, both between 0 and 1, or between 0 and 255. Try extra concerning the perform via this link.

    import turtle
    
    turtle.colormode(255)
    tim = Turtle()
    tim.form("turtle")
    tim.shade("coral")

    As we’re utilizing the RGB colours of their 0-255 format, now we have added 255 as an argument. Furthermore, now we have additionally created the turtle object from the Turtle class within the Python turtle module and referred to as it tim, in addition to personalized its shapes and shade. We will likely be utilizing this turtle forward as our drawing software.

    Positioning our Turtle

    Now that now we have created the turtle object, allow us to visualize with the assistance of the display object.

    from turtle import Display
    
    display = Display()
    display.exitonclick()
    Turtle Object Custom-made (Picture by Writer)

    As may be seen from the picture above, the turtle is positioned in the midst of the display. We want the turtle to be on one nook in order that it begins creating the dots in a line. We are able to select the decrease left nook as the place to begin, with the turtle shifting from left to proper after which upwards whereas drawing the dots.

    We are able to obtain this with the turtle perform setheading() that takes an angle as a parameter to set the path of the turtle, and after some hit and trial, we all know this may be finished by setting the angle at 225. We are going to then transfer ahead by a specific distance, say 300. Right here is how our turtle is now on the backside left:

    Turtle Positioned (Picture by Writer)

    We are going to once more set the path the turtle is heading to 0, so we could begin with our dot drawing.

    Turtle Path Set (Picture by Writer)

    Drawing the Dots

    Now, since our turtle’s path is ready, we’ll begin drawing the dots. We are going to use the turtle’s dot method, which takes the scale of the dot and the colour to be stuffed. We are going to obtain this dot drawing via the for loop, conserving in thoughts the whole variety of dots we would like. If we would like a ten by 10 grid of dots, the whole variety of dots will likely be 100. After each tenth dot, the turtle has to go up by a line and proceed drawing the dots. We are going to use the modulo operation for this goal. Furthermore, we’ll import and use the random module to randomly select a shade for every dot.

    We are going to use the ahead and setheading strategies within the for loop to create the dots shifting ahead, after which up:

    import random
    
    number_of_dots = 100
    
    for dot_count in vary(1, number_of_dots + 1):
        tim.dot(20, random.selection(rgb_colors))
        tim.ahead(50)
        if dot_count % 10 == 0:
            tim.setheading(90)
            tim.ahead(50)
            tim.setheading(180)
            tim.ahead(500)
            tim.setheading(0)
    
    Turtle Creating the Dots (Picture by Writer)

    Hiding the Turtle and the Traces

    As soon as our dots are created, we have to disguise the turtle and the traces. We are able to simply do that with the hideturtle() and penup() strategies.

    tim.penup()
    tim.hideturtle()

    That is what the ultimate output will appear like as soon as we execute the above traces of code:

    Python Turtle Art work (Picture by Writer)

    Conclusion

    As may be seen above, now we have efficiently created a fantastic paintings following Hirst’s dot method. Python’s colorgram module allowed us to extract a fantastic shade palette, and the turtle module helped us in creating the paintings utilizing that palette. That is only a fundamental instance of how such lovely items may be created utilizing code, and what occurs when artwork and programming coincide.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleThe brewing GenAI data science revolution
    Next Article The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs
    ProfitlyAI
    • Website

    Related Posts

    Artificial Intelligence

    Optimizing Data Transfer in Distributed AI/ML Training Workloads

    January 23, 2026
    Artificial Intelligence

    Achieving 5x Agentic Coding Performance with Few-Shot Prompting

    January 23, 2026
    Artificial Intelligence

    Why the Sophistication of Your Prompt Correlates Almost Perfectly with the Sophistication of the Response, as Research by Anthropic Found

    January 23, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    “Create a replica of this image. Don’t change anything” AI trend takes off

    May 6, 2025

    The Good-Enough Truth | Towards Data Science

    April 17, 2025

    How to Build an AI-Powered Weather ETL Pipeline with Databricks and GPT-4o: From API To Dashboard

    December 26, 2025

    Time Series Isn’t Enough: How Graph Neural Networks Change Demand Forecasting

    January 19, 2026

    AI-kompanjoner använder manipulativa taktiker för att förlänga konversationer

    October 16, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    Most Popular

    ASR (Automatic Speech Recognition) – Definition, Use Cases, Example

    April 5, 2025

    The Role of Natural Language Processing (NLP) in Insurance Fraud Detection and Prevention

    April 4, 2025

    Frontier2075 – utforska mänsklighetens framtida kunskapsutveckling

    April 12, 2025
    Our Picks

    Optimizing Data Transfer in Distributed AI/ML Training Workloads

    January 23, 2026

    Achieving 5x Agentic Coding Performance with Few-Shot Prompting

    January 23, 2026

    Why the Sophistication of Your Prompt Correlates Almost Perfectly with the Sophistication of the Response, as Research by Anthropic Found

    January 23, 2026
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 ProfitlyAI All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.