top of page

How to draw image with python using sketchpy [simple method!!!]




Let's see how to draw literally any image with sketchpy , in the previous version we used svg file to draw, but the current version works with JPEG, JPG, PNG, want to know how


then let's do it


NOTE : Make sure you have installed python version 3.6.x on your pc

INSTALLING SKETCHPY


In order to use sketchpy we obviously we need to install it right😂. so let's install it with the following command, past it on your command prompt or terminal


pip install sketchpy
NOTE: if you are installing it for the first time then you can use the above command, else if you have already install it the you the below command

pip install sketchpy==0.0.22

NOTE: 0.0.22 represents the current version of sketchpy in the time of writing this blog


What next after installing🤔


now we have install it successfully, so now with just 3 lines of code you can draw any image you have


use the following code :


from sketchpy import canvas
obj = canvas.sketch_from_image("IMAGE PATH")
obj.draw(threshold = 127)

NOTE: replace the IMAGE PATH with the path of the image you need to draw and set the threshold value, by default it is 127, the higher the value the higher the details, max value is 255


Results


once you have done all the step mentioned above you are good to go, now run your code to

see the results


YouTube video on how it's done


Warping up

so we have see how to install sketchpy package, how to draw image with it, if got stuck at any point or you need to clarify any doubts then contact me on discord


if you are a developer, then feel free to contribute to our project on github


Stay tuned and stay creative , see you next time

253 views0 comments

Recent Posts

See All

Comments


bottom of page