Open sonichy opened 1 year ago
@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?
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.
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.
Useless
Export image to jpg or png.