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

exportImage: add option to specify filename #98

Closed
hainm opened this issue May 1, 2016 · 2 comments
Closed

exportImage: add option to specify filename #98

hainm opened this issue May 1, 2016 · 2 comments
Assignees
Milestone

Comments

@hainm
Copy link
Contributor

hainm commented May 1, 2016

currently the downloaded image's name is 'screenshot.png'. If I do the screenshot several times, Chrome adds 'screenshot(2).png' . So I need to rename it.

@arose arose added this to the 0.7 milestone May 2, 2016
@arose arose self-assigned this May 2, 2016
@arose
Copy link
Collaborator

arose commented May 2, 2016

I refactored the image generation (5ca95ef) and stage.makeImage now returns a Blob via a Promise. So you can trigger download with whatever name you like. You can also send the Blob-bytes to the Python kernel in nglview.

stage.makeImage( {
    factor: 1,
    antialias: true,
    trim: false,
    transparent: false
} ).then( function( blob ){
    NGL.download( blob, "screenshot.png" );
} );

@arose arose closed this as completed May 2, 2016
@hainm
Copy link
Contributor Author

hainm commented May 2, 2016

that's perfect. Can't wait to have new NGL in NGLView.

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

No branches or pull requests

2 participants