Save window rendering results to image

Dear VTK team,

I’m looking for a way to save my rendering results from the RenderWindow to an image in VTK.js. In python for example I did it using vtkWindowToImageFilter function but I cannot find something like this in VTK.js. Could you please advice me something?

Olga.

Hi, you can take a screenshot of your vtk.js window via captureImages:

renderWindow.captureImages()[0].then(
  (image) => { console.log(image); }
);

image will contain a data URI with a png-encoded image.

2 Likes

Thank you so much!