top of page

How to draw Svg file with Python

Updated: Apr 9, 2022


Content in this blog

  • How to install sketchpy

  • How to convert a image to svg file

  • How to draw svg file with sketchpy

REQUIREMENTS

  • Python(above 3.6.x)

  • Any text editor(VS Code recommended)

  • Only supported on pc


How to Install Sketchpy


Open Vs Code


Open new terminal by pressing CTRL+`




Type the following code and press enter


pip install sketchpy


installation process is done..


HOW TO CONVERT A IMAGE TO SVG FILE


Use the following website to convert image to svg file




Upload your image by pressing the upload button

Play with the values, once you are satisfied you can download the SVG file


Note : Sketchpy specifically works only with this website, if you use any other svg file then it might not work


HOW TO DRAW SVG FILE WITH SKETCHPY


Use the following code to draw a svg file



from sketchpy import canvas

pen = canvas.sketch_from_svg("path of the SVG file")

pen.draw()

Note : you need to specify the path of the image in sketch_from_svg()

Run the code





sample output







That's if you made it,


Subscribe our YouTube channel for more such videos and contents

If you have any doubt check out our discord server

545 views0 comments

Commenti


bottom of page