// Screenshot
vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter = vtkSmartPointer<vtkWindowToImageFilter>::New();
windowToImageFilter->SetInput(renderWindow);
+#if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1
+ windowToImageFilter->SetScale(1);
+#else
windowToImageFilter->SetMagnification(1);
+#endif
windowToImageFilter->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel
windowToImageFilter->Update();
if (!fileName.isEmpty()) {
vtkSmartPointer<vtkWindowToImageFilter> w2i = vtkSmartPointer<vtkWindowToImageFilter>::New();
w2i->SetInput(widget->GetRenderWindow());
+#if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1
+ w2i->SetScale(1);
+#else
w2i->SetMagnification(1);
+#endif
w2i->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel
w2i->Update();
vtkImageData *image = w2i->GetOutput();