Header Ads

Seo Services

Draw ANIME Character with PYTHON, Just 3 lines of code using Sketchpy

Do you want to draw some cool pictures with a few lines of Python code? SketchPy is here to help. In this article, let’s look at what sketchpy is and how you can use it to draw pictures using Python on your computer.



Python SketchPy Tutorial


Do you want to draw some cool pictures with a few lines of Python code? SketchPy is here to help. In this article, let’s look at what sketchpy is and how you can use it to draw pictures using Python on your computer.

Let’s dive right in.

Installing SketchPy

Sketchpy is a Python module for animating drawings of images. The sketchpy module is created on top of the turtle module in Python.

To install sketchpy on your computer, you can go to your command prompt (command line) and run the following command.

pip install sketchpy

Once you enter this command, sketchpy will get automatically installed on your system.

Now open your text editor and use the following code to draw any images.


from sketchpy import canvas 
obj = canvas.trace_from_image("IMAGE PATH")obj.draw()

Output:


you have 3 customization option in this new module. they are

  1. scale
  2. save
  3. intensity
SCALE - It is use to scale the drawn image, it the value is less than 1,the size will be less than the original size. If the scale is greater than one, then the drawn image will be larger than the original image. if the scale value is equal to one then the image size will be the same

SAVE -  It is used to save the drawn image automatically when the sketching is down. so you can easily use the image to share your work. if this value is set the True then the image will be saved as screenshot.png file in the current working directory.

INTENSITY - This parameter is used to specify the intensity of the details should be available in the drawn image,. the maximum value is 255 and minimum value is 0, the optimal value for this lies around 220 - 250.

Some other sketches using this package




you can download the full code along with the source images in here

Thank you. lets meet in another blog.

DEMO


you can follow me on my youtube channel here


No comments