- Name: Pranjal Sarnaik
- Date: 2024-12-18
This project involves creating a Hirst painting using extracted colors from an image file (image.jpg
). The program uses the colorgram
library to extract 30 colors and then utilizes those colors to create a 10x10 grid of colorful dots resembling a Hirst painting.
- The
create_color_list.py
file extracts colors from the image and generates a list of RGB values. This list is manually copied and pasted into theapp.py
file for further use. - The
app.py
file uses theturtle
module to generate the Hirst painting based on the extracted colors.
- Run
create_color_list.py
to generate the list of colors fromimage.jpg
. - Copy the generated color list and paste it into the
app.py
file. - Run
app.py
to create the Hirst painting.
- Level: Intermediate
- Skills: Python programming, Turtle graphics, Color extraction using
colorgram
- Domain: Creative Programming, GUI-based Projects
- Extracts colors from an image using the
colorgram
library. - Creates a Hirst-style painting with 100 dots (10x10 grid) using the
turtle
andrandom
modules. - Three functions are used to build the painting:
starting_point()
: Fixes the starting position of the painting.draw_line()
: Draws a straight line of 10 dots.turn_and_move()
: Moves the turtle to the next row.
- Clone this repository:
git clone https://github.com/pranjalco/hirst-painting-intermediate.git
- Navigate to the project directory:
cd hirst-painting-intermediate
- Install the required dependencies:
pip install colorgram.py
- Ensure Python 3.9 or later is installed on your system.
- To generate the color list:
- Run
create_color_list.py
using an IDE or terminal:python create_color_list.py
- Run
- Copy the color list output from the console and paste it into the
app.py
file. - To create the Hirst painting:
- Run
app.py
using an IDE or terminal:python app.py
- Run
- View the final output image (
hirst_painting_final_output.PNG
) located in the./screenshots
folder.
You can see the Hirst painting output in the file:
- Path:
./screenshots/hirst_painting_final_output.PNG
Created by Pranjal Sarnaik
© 2024. All rights reserved.
Let me know if you'd like to make further adjustments! 😊