Thursday, 19 April 2018

How robot draws a picture | Robot drawing sketch | Sketching Robot

Hi Guys,

In this post, I wish to show how a UiPath robot draws a picutre in Microsoft Paint. 

I really got wondered when I saw the post of alekh Barli, CEO of INTELLIBOT.IO where he showcased the capability of Intellibot RPA to control the mouse at pixel level by drawing a picture in MS Paint. Here is his the post in LinkedIn. 

Because it's the same process I automated a decade back using a different technology.  At that time in 2008, I did a fun project to map a picture by coloring the Excel cells using VBA. Basically, I used a VBA code to read all the XY cordinates and color of a picture into an array and I colored each cell in a worksheet using the array imagining it is a pixel of a picture. Then if you keep the zooming of the worksheet to 10%, it will exactly looks like the same picture. 

This made me thinking that why can't I upgrade my project to a robot. In fact, UiPath also works on the Microsoft .NET background. So it's not a big task to to upgrade VBA to UiPath.

Then after spending couple of hours, I managed to upgrade the sketching project to UiPath. 

But there is a big change I made to overcome the constraints :

I was reading the actual colors of the picture in my old project and making the same color in Excel cell. Since I'm using MS Paint to draw the picture, there is easy shortcut available to change the color or the brush for each pixel. If I use the UI elements in Paint to change the color on each color, my robot will take a day to paint a picture. So I just read only the cordinates of the darker shades of the picture and mapped only those dots in Paint to imitate the picture.

The outcome is not so great like my old project since the we are not coloring everything, but still it's enough to showcase the power of the UiPath robot.

You can see the magic in a short video below




Note :


  • The workflow is created using UiPath RPA software
  • Robot reads the coordinates of the picture and points the coordinates in Paintbrush to recreate the picture.
  • I will share the workflow and logic in a different video very soon.