Skip to content

generate image files from canvas #106

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

Closed
cekees opened this issue Jun 20, 2017 · 3 comments
Closed

generate image files from canvas #106

cekees opened this issue Jun 20, 2017 · 3 comments

Comments

@cekees
Copy link

cekees commented Jun 20, 2017

Our team is looking for a way to generate image frames (for animations) based on our pythreejs canvas. Would this be a worthwhile thing for us to try adding to pythreejs?

https://stackoverflow.com/questions/15558418/how-do-you-save-an-image-from-a-three-js-canvas

@abelnation
Copy link
Contributor

abelnation commented Jun 20, 2017 via email

@elPistolero
Copy link

I'm trying to implement this.
From what I understand I need to register a callback in Renderer.py:

self.on_msg(self._screenshot_ret_val)

And in Renderable.js I have a screenshot function that sends data back to the python side:

this.send({
    type: '...',
    method_name: 'screenshot',
    ret_val: ...,}, this.callbacks(), null);

However, I'm unclear on how ret_val needs to be packaged. I tried to set ret_val: this.renderer.domElement.toDataURL(), but then session.py complained that it could not handle a string and was expecting a byte object.
Are there some js functions I can call with exec_three_obj_method that actually return something so that I can gain a better understanding on how the communication from javascript to python is supposed to work?
I tried calling localToWorld from Object3D.js but that method could not be found.

@maartenbreddels
Copy link
Member

see also my comment here

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

No branches or pull requests

4 participants