Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save screen.capture.image as a png image #222

Closed
IChocolateKapa opened this issue Jul 18, 2016 · 12 comments
Closed

How to save screen.capture.image as a png image #222

IChocolateKapa opened this issue Jul 18, 2016 · 12 comments

Comments

@IChocolateKapa
Copy link

RT

@demipixel
Copy link

demipixel commented Jul 19, 2016

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

@IChocolateKapa IChocolateKapa changed the title How to save scrren.capture.image as a png image How to save screen.capture.image as a png image Jul 19, 2016
@IChocolateKapa
Copy link
Author

@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);

@octalmage
Copy link
Owner

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.

@octalmage
Copy link
Owner

You can use the code here:

#191

@Disorrder
Copy link

anyway, how can I get image data from buffer?

@LazyFatArrow
Copy link

is this solved ?

@tarunjuneja
Copy link

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.

@Disorrder
Copy link

@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.

@octalmage
Copy link
Owner

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.

@Disorrder
Copy link

@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 -_-

@octalmage
Copy link
Owner

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

@octalmage
Copy link
Owner

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!

Repository owner locked and limited conversation to collaborators May 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants