Take screenshot with Electron of Desktop


Hello I am making a program for Windows and part of it involves taking screenshots of the desktop or whatever program user is using can be another app , game etc but the screenshot must be taken.

Essentially replicating the print screen button is this possible?


You should be able to use the desktop capturer. This returns a video stream but I’m pretty sure you can use it to get a single frame. There may be a more efficient way to do it but I’m using this to capture the video stream of other application windows. If you can get video I’m sure you could manipulate it to get a still shot.


I will try using this, but another app already does this https://getkap.co/ and this program is open source and all it does take screenshots, I will try to see if this is possible via manipulating kap’s source code for my use and update you once I can confirm that it is possible or not.


Hi Matt,

I am Madhuri Thakur . I am building a desktop app for screen recording of my user’s desktop but especially only when user is playing a video game and not watching other videos or anything.
Whenever a game start on user’s desktop, the application should automatically detect that game is being played. and should start record automatically without a manual start.
IS electronJS provide this service?
Please help me with it.

One of the reference example of such software is https://plays.tv/ but based on .net.

Many thanks in advance.



Something like that is not trivial if you do it the right way.

Perhaps you could learn something from…
https://github.com/jp9000/obs-studio (current generation)
https://github.com/jp9000/obs (older generation)



I liked the idea. I am going to make something like that for me.