citronneur / node-rdpjs

Remote Desktop Protocol for Node.js
GNU General Public License v3.0
895 stars 154 forks source link

How do I save a screenshot of the returned bitmap file ? #17

Open Mylab6 opened 8 years ago

Mylab6 commented 8 years ago

I've been working with this for a solid 4 hours, and I can not figure it out.

The best I can do is an array of the pixel values .

Mikej81 commented 7 years ago

Did you figure this out? I can do it on the client-side pretty easily with canvas.toDataUrl(), but I want it on the server-side on mouse isPressed = true.

EddieCanales commented 7 years ago

@Mikej81 @Mylab6 Here's a gist that shows how I've done it. https://gist.github.com/FabledWeb/8253b74ad3f26778aadfb063f19a6a46

The idea is to create a buffer image the size of the screen, then as you get back bitmaps (they are bitmaps of a part of the screen), write that to the buffer image at the correct location.

Then whenever you need to see the screen (on some interval or based on some other code), write that to disk.

Mikej81 commented 7 years ago

Nice! I'll try this out as soon as I can. This is how I'm doing it on each mouseclick now, not ideal, but its working: https://github.com/Mikej81/WebRDP/blob/master/socket/index.js#L53