Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Canyon Spectral:ON CF 8 Electric Mountain Bike: Beginner-Friendly, Under $5K
    • US-sanctioned currency exchange says $15 million heist done by “unfriendly states”
    • This New Air Purifier Filter Can Remove Cannabis Smoke Odor, Just in Time for 4/20
    • Portable water filter provides safe drinking water from any source
    • MAGA Is Increasingly Convinced the Trump Assassination Attempt Was Staged
    • NCAA seeks faster trial over DraftKings disputed March Madness branding case
    • AI Trusted Less Than Social Media and Airlines, With Grok Placing Last, Survey Says
    • Extragalactic Archaeology tells the ‘life story’ of a whole galaxy
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Saturday, April 18
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»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

    Editor Times FeaturedBy Editor Times FeaturedDecember 18, 2025No Comments7 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    been to an artwork museum and questioned how such a seemingly peculiar piece of artwork can get so well-known or be offered at such a excessive value? Or how art work that appears really easy to make with such fundamental methods could also be so revered and appeal to a giant crowd of bidders? Such is the case with Hirst’s spot work.

    Damien Hirst is an English artist well-known for his modern artwork on life, loss of life, and sweetness. His well-known spot work embrace 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 offered at auctions for as much as a million dollars!

    On this article, we are going to use Python’s colorgram and turtle module to create spot work, inspiration from Hirst’s coloration palette and methods. 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. Via this enjoyable and attention-grabbing Python tutorial, we are going to be taught to implement the idea of OOP in programming in addition to find out how we will get our goal fulfilled utilizing modules and just some strains of code.

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

    Spot Work

    Hirst’s spot work embrace small spots of assorted 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 so as 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 gap between them, and the colour scheme used.

    For reference, contemplate checking these work by this link.

    Extracting Colours

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

    pip set up colorgram.py

    Subsequent, we are going to 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)

    Once we run the above strains of code, it should print out 20 colours which can be current within the reference picture:

    Colours Extracted from the Reference Picture (Picture by Creator)

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

    Creating the Colour Checklist

    First, we are going to create an empty record 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 record with applicable formatting. For this goal, we are going to use the for loop:

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

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

    Importing Turtle and Configuring Fundamental Settings

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

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

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

    Positioning our Turtle

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

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

    As might be seen from the picture above, the turtle is positioned in the course of the display screen. 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 achieved by setting the angle at 225. We are going to then transfer ahead by a selected distance, say 300. Right here is how our turtle is now on the backside left:

    Turtle Positioned (Picture by Creator)

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

    Turtle Course Set (Picture by Creator)

    Drawing the Dots

    Now, since our turtle’s path is ready, we are going to 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 by 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 might 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 are going to import and use the random module to randomly select a coloration 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.alternative(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 Creator)

    Hiding the Turtle and the Strains

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

    tim.penup()
    tim.hideturtle()

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

    Python Turtle Art work (Picture by Creator)

    Conclusion

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



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    A Practical Guide to Memory for Autonomous LLM Agents

    April 17, 2026

    You Don’t Need Many Labels to Learn

    April 17, 2026

    Beyond Prompting: Using Agent Skills in Data Science

    April 17, 2026

    6 Things I Learned Building LLMs From Scratch That No Tutorial Teaches You

    April 17, 2026

    Introduction to Deep Evidential Regression for Uncertainty Quantification

    April 17, 2026

    memweave: Zero-Infra AI Agent Memory with Markdown and SQLite — No Vector Database Required

    April 17, 2026

    Comments are closed.

    Editors Picks

    Canyon Spectral:ON CF 8 Electric Mountain Bike: Beginner-Friendly, Under $5K

    April 18, 2026

    US-sanctioned currency exchange says $15 million heist done by “unfriendly states”

    April 18, 2026

    This New Air Purifier Filter Can Remove Cannabis Smoke Odor, Just in Time for 4/20

    April 18, 2026

    Portable water filter provides safe drinking water from any source

    April 18, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    German startup remberg secures €15 million to expand its AI-powered maintenance platform

    May 20, 2025

    Data Culture Is the Symptom, Not the Solution

    November 10, 2025

    The Doomers Who Insist AI Will Kill Us All

    September 5, 2025
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

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