Sketchpy Python Programs

Python Program To Draw MS Dhoni Sketch

Last updated January 31, 2024 by Jarvis Silva

In this tutorial I will show you how to draw MS Dhoni using python, Mahendra singh dhoni is one of the best indian cricket team captain and I am a fan of him so I decided to create this python program to draw MS Dhoni Sketch so follow till the end.

To create this program we will use the sketchpy library in python it is a library which allows us to draw sketch of anything by just giving a image of it so make sure you have sketchpy installed use below command to install:

pip install sketchpy

After you install the library open your code editor and create a python file now let’s code in it.

Python Code To Draw MS Dhoni

from sketchpy import canvas

img = canvas.sketch_from_image("ms-dhoni.png")

Above is the 3 lines of code which will draw MS Dhoni this is the power of a library it extracts all the complex code, so copy and paste the code, before running it you need to give a ms dhoni image dowload the image file below and move it in your python program folder.

Make sure you give the correct path name of the image in the sketch_from_image() function, so now you can run this program and you will see a new window opened and in the terminal you will see a loading bar after that completes it will draw ms dhoni in the newly opened window looking like below image:

MS Dhoni Sketch

If you run the program successfully you will get output like above so we successfully drawn ms dhoni using python, I hope you were able to successfully create this program.

Here are some more tutorials for you:

Thank you for reading, Have a nice day 😊