How to make a screenshot google chrome extension

I am trying to create a chrome extension that captures the screen of a webpage and makes an ajax call with the captured picture.

I want the screen capture to work like a capture area screenshot in the chrome developer tools.

Question.

  1. Is there a way to call the capture area screenshot function of chrome developer tools from javascript code?

  2. Can I get a rough idea of ​​what language the capture area screenshot function of Chrome Developer Tools is made in?