Robotjs: How to save screen.capture.image as a png image

Created on 18 Jul 2016  Â·  12Comments  Â·  Source: octalmage/robotjs

RT

enhancement

All 12 comments

Googled "save buffer as png node.js"

First three things that came up:

http://stackoverflow.com/questions/6926016/nodejs-saving-a-base64-encoded-image-to-disk

My Express app is receiving a base64-encoded PNG from the browser (generated ..... Right answer -> Create and save buffer image node.js fs.

Eh, maybe.

http://stackoverflow.com/questions/20267939/nodejs-write-base64-image-file

My NodeJS-Server receives a picture base64 encoded. ... Then you can save the buffer using your above method. fs. ... Thanks for this Julian, I noticed you are putting in a png base64 string and outputting a jpg. Does that ..

Maybe again.

https://www.npmjs.com/package/png

A C++ module for node-js that converts an RGB and RGBA buffers to PNG images ... You can either send the png_image to the browser, or write to a file, or do ...

Perfect

@demipixel ,I tried the simplest code as following, but it didn't work, could you successfully save it as a picture?

var img = robot.screen.capture(0, 0)ï¼›
fs.writeFile('output.png',  img.image)ï¼›

This is in the works. The image returned from screen.capture contains more than just the image, so just writing it to a file won't work as expected. Soon there will be a function to save it though.

anyway, how can I get image data from buffer?

is this solved ?

Can someone post information regarding how can i split images in the buffer so that i can save them individually?

Is there any indication in the buffer which i can use to understand its the end of a image.

@developer239 at first, you spammed to all participants. 2nd is it's just your job, to fight with any issue you find writing your code. Of course, that two days may be wasn't good at all, but you got some experience of what Buffer is and smth like that. If you need another functionality, just have a look for another libs (at least, i found robot-js with similar screen capturing).
Watching your code I see you're did not understand how buffer works anyway.
Please be correct a little more.

That user has been blocked. The documentation does not mention saving a screen capture to a file, since it's currently not possible (or implemented). As always, I'm happy to accept PRs or collaborate. I'm extremely busy with work and screenshot saving isn't something I have a need for.

@voteTrump2020 nice name lol.
Well, it's open source, so may be you can fix it? Make PR for it. I think, most of us are busy on their job, so this feature is not popular, but may useful for someone else, thats why no need to delete this code.
Still can't believe developers like you are alive -_-

Sorry guys, I've deleted the comments and reported the user to GitHub.

I'm going to lock and close this issue, I don't plan on implementing screen saving in the near future, going to focus on bugs and getting the existing functionality working as expected. This project needs collaborators, anyone interesting in helping please reach out to me.

Any questions about screen saving or capturing should go in #13.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Androiderr picture Androiderr  Â·  4Comments

HopefulLlama picture HopefulLlama  Â·  3Comments

quinton-ashley picture quinton-ashley  Â·  6Comments

tms1337 picture tms1337  Â·  4Comments

pg07codes picture pg07codes  Â·  3Comments