How to draw AI HOSHINO with just 3 Lines in python using Sketchpy, Extremely EASY!!!

In a world where technology continues to push the boundaries of artistic expression, SketchPy emerges as a game-changer. Join us on a thrilling journey as we explore how SketchPy's innovative algorithms effortlessly bring AI Hoshino's mesmerizing beauty to life through the power of sketching. 



REQUIREMENTS:

  • A computer with a internet connection
  • Python Interpreter
  • An image.
That'ts it!!

There are tones of internet contents about installing python interpreter, you can refer any of those contents to install python interpreter to your system. I recommend install python version above 3.8.x


now before writing the program and running the code, we need to install sketchpy package. which helps us to draw the sketch of any image with just 3 lines.


open your command prompt and enter the following line.


pip install sketchpy==0.1.7

 At the time of writing this blog the latest version of sketchpy is 0.1.7 if you want to install the pervious of the higher version just replace the version with the version that you want to install. you can refer this Github page to get more info about sketchpy.


Now after install the package, it is time to write the code. you can use the following code to draw AI HOSHINO.

from sketchpy import canvas

obj = canvas.trace_from_image("image.jpg", scale= 0.75, intensity=240, save=False, details=5)
obj.draw()

replace the image.jpg with the actual path of the image, you can get the code with the images in here.

  • you can change the value of scale which magnifies of minimize with image, 
  • intensity represents the details that should be present on the image
  • save, if it is set to true, you will get a screenshot of the image once the sketching is done, it is set to false by default.
  • details, it is similar to the intensity but by increasing the value of details the noises like small dots can be removed, which increases the speed of sketching.

The output of the code with ai hoshino image will be something like this.




Once you have written the code you can run the code, and watch the results. or you can just watch the video below to know how it works.




That's it. I hope that you learnt something for this blog. If you want to know more about sketchpy and some cool python projects consider subscribing to my youtube channel.


Note: fellow youtubers who are using this video should mention my channel code hub on either the title or in the description to avoid copyrights problem.


Have a nice day.

0 Comments