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

Render the output to an image #79

Open
koraysels opened this issue Jan 8, 2015 · 5 comments
Open

Render the output to an image #79

koraysels opened this issue Jan 8, 2015 · 5 comments
Labels

Comments

@koraysels
Copy link

is it possible to grab a frame and rasterize/output it as an image?
for example to share the current image on facebook? I tried using phantomjs but I get a WebGL error

phantom stdout: ReferenceError: Can't find variable: WebGLFramebuffer

This is probably because PhantomJs does not support webgl..

@brianchirls
Copy link
Owner

Nothing here is going to work without support for webgl. You need this to run outside of a browser?

@koraysels
Copy link
Author

wow quick response, awesome!
No it does not have to run outside a browser. I have a webapp hosted on heroku and I want users to save their image. So anything will do actually :-)

@brianchirls
Copy link
Owner

Oh yeah that's not a problem. You can grab it straight from the canvas itself with toDataURL, as in this example:
http://stackoverflow.com/questions/13198131/how-to-save-a-html5-canvas-as-image-on-a-server

It shouldn't matter whether the canvas has a 2d context or webgl. It's up to you to convert the resulting dataURI into a file, either on the server or in the browser, but that's easy enough. A little Googling should find you a solution or two.

@darkyen
Copy link

darkyen commented Feb 10, 2015

If you really really want an image like a blob which the user can save out of the box, you can try using .toBlob on a supporting browser you can also specify quality of jpeg image created.

@darkyen
Copy link

darkyen commented Feb 11, 2015

On a second thought though @brianchirls having a direct method / output form which literally emits a file sounds pretty reasonable

.target(fileNode);
// and later
fileNode.getFile(); // async call gets the rendered file..

Not that it was hard to write self but it can be cool to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants