top of page

Draw Custom image with Sketchpy


Contents of this blog

  • what is sketchpy

  • installing sketchpy

  • how to draw a custom image with sketchpy

Before getting into the blog , make sure you have python 3.6.x installed in your system





What is sketchpy?


sketchpy is a graphics module in python which is use to draw svg images ,

it also have library which contains predefined coordinates of some image , you can

play with it,


other than draw a predefined image you can also draw your own image or your loved one's image

by converting it to a svg form, enough talking theory ,let's get into it



Installing sketchpy


open your command prompt or terminal, and type the following command and hit enter

pip install sketchpy

this command will install sketchpy module into your system



Drawing custom image

in order to draw a custom image in sketchpy, it should be in the form of svg(Scalable Vector Graphics)


we are going to use the following website to convert image to svg. website link



Note: sketchpy can only draw svg file generated from this website only, you cannot draw other svg files with it

upload your image to the website, and click B&W option on the left, you image will be in black and white form now, then download the svg file from downloads option on top


now open you text editor for writing your python program


Type the following code and run it


from sketchpy import canvas
obj = canvas.sketchpy_from_svg('full path to the svg file')
obj.draw()

note: replace your path to the svg file that you have downloaded from the website in canvas.sketchpy_from_svg('path')

that's it, you have successfully draw your image with sketchpy


if you got stuck at any point or you have some doubt, then contact us on discord or instagram


stay tuned for more such blogs

Comments


bottom of page