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

Export image #1243

Open
sonichy opened this issue May 6, 2023 · 4 comments
Open

Export image #1243

sonichy opened this issue May 6, 2023 · 4 comments

Comments

@sonichy
Copy link

sonichy commented May 6, 2023

Export image to jpg or png.

@z3dev
Copy link
Member

z3dev commented May 15, 2023

@sonichy the focus of JSCAD is 3D printing, and therefore the common interchange formats are supported.

Do you want the CLI (command line tool) to export an image?

@sonichy
Copy link
Author

sonichy commented May 15, 2023

Export image is a basic function of 3D application, it take a preview of a product.
I tried js extension to turn canvas to image, but get a black image.

var canvas = document.getElementsByTagName('canvas')[0];
var link = document.createElement('a');
var fn = document.title + '_' + canvas.width + 'X' + canvas.height + '.png';
link.download = fn;
link.href = canvas.toDataURL("image/png");
link.click();

If not support, I had to use system screen capture instead, then use image editor to cut the image.

@hrgdavor
Copy link
Contributor

one step towards a fix would be to set preserveDrawingBuffer to true for webgl context
https://stackoverflow.com/questions/26783586/canvas-todataurl-returns-blank-image

after that your snippet would work likely. and then somebody could make a PR to add PNG as one of export options.

@sonichy
Copy link
Author

sonichy commented May 15, 2023

Useless

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

3 participants