This Python script utilizes the Turtle graphics library to draw images in a creative way. It converts an input image into a simplified representation using binary thresholding, Canny Edge Detection, and Turtle graphics.
- Python 3.x
- OpenCV (
pip install opencv-python
) - AceD (Automated Canny Edge Detection) (
pip install ace-d
) - Turtle Graphics Library (built-in with Python)
-
Clone the repository:
git clone https://github.com/real0x0a1/DrawImageToTurtle.git
-
Navigate to the project directory:
cd DrawImageToTurtle
-
Run the script with required arguments:
python3 sketch.py --input input_image.jpg --output output_image --width 800 --height 600
Adjust the
--input
to your input image path and--output
to the desired output image name. You can also specify--width
and--height
for the dimensions of the turtle drawing area. -
View the Output:
The script will create an
.eps
file in the project directory. You can use online tools or command-line tools to convert the.eps
file to a more common image format like PNG.
--input
(-in
): Path to the input image file.--output
(-o
): Name of the output image file (without extension).--width
(-wt
): Width of the turtle drawing area.--height
(-ht
): Height of the turtle drawing area.
python3 sketch.py --input input_image.jpg --output output_image --width 800 --height 600
- Tune the constants in the script (
THRESHOLD_VAL
,SHAPE
,CUTOFF_LEN
, etc.) according to your preference and the characteristics of the images you are working with. - The script outputs an
.eps
file; you can convert it to a PNG or any other image format using available tools.
- Ali (Real0x0a1)