pchen66/panolens.js

How to download image seen on the canvas / page?

Closed this issue · 1 comments

Dear experts,

I like the panolense when I visited https://pchen66.github.io/panolens.js/ . Its impressive and great work done by contributors.

My query is: How do I download the image as well as video (two separate code and instances).? Let's say, I clicked on left up etc and moved from original start point. Now, I want to capture this image / video frame which is present on the screen. Is it possible to do that?

I tried downloading image from canvas, but it doesn't work. Code that can be run on the same example page, in chrome debugger:

var downloadPanolens = function(){
var link = document.createElement('a');
link.download = 'filename.png';
link.href = document.querySelectorAll("section.background canvas.panolens-canvas")[0].toDataURL("image/png")
link.click();
}
downloadPanolens()

or

var canvas = document.querySelectorAll("section.background canvas.panolens-canvas")[0];
var img = canvas.toDataURL("image/png");
document.write('');

But it doesn't work.

Hi,

sorry to bother all. Its a Three.js issue. resolved as per another tip here https://threejsfundamentals.org/threejs/lessons/threejs-tips.html