<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
Hi guys,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 0px; margin-bottom: 0px;">
I have found a simple yet executable example. In case anyone also wants it, here is the link: <a href="https://gist.github.com/certik/5687727" target="_blank" id="LPlnk243646" title="https://gist.github.com/certik/5687727
Ctrl+Click or tap to follow the link">https://gist.github.com/certik/5687727</a></div>
<br>
<p></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Wang Q <wangq1979@outlook.com><br>
<b>Sent:</b> 06 May 2016 21:15<br>
<b>To:</b> VTK Users<br>
<b>Subject:</b> save screenshot as png image</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi guys,</p>
<p><br>
</p>
<p>I want to save screenshot as png image following the example. Unfortunately, the code went into
<span style="font-family:Calibri,Arial,Helvetica,sans-serif,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size:16px">
windowToImageFilter->Update()</span> method and never came back. Below is the snippet:</p>
<p><br>
</p>
<p></p>
<div>// Screenshot  </div>
<div>    vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter =</div>
<div>        vtkSmartPointer<vtkWindowToImageFilter>::New();</div>
<div>    windowToImageFilter->SetInput(renderWindow);</div>
<div>    //windowToImageFilter->SetMagnification(3); //set the resolution of the output image (3 times the current resolution of vtk render window)</div>
<div>    //windowToImageFilter->SetInputBufferTypeToRGBA(); //also record the alpha (transparency) channel</div>
<div>    //windowToImageFilter->ReadFrontBufferOff(); // read from the back buffer</div>
<div>    windowToImageFilter->Update();</div>
<div><br>
</div>
<div>    vtkSmartPointer<vtkPNGWriter> writer =</div>
<div>        vtkSmartPointer<vtkPNGWriter>::New();</div>
<div>    writer->SetFileName("e:/screenshot2.png");</div>
<div>    writer->SetInputConnection(windowToImageFilter->GetOutputPort());</div>
<div>    writer->Write();</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>renderWindow->Render();</div>
<div>    timerLog->MarkEvent("finish rendering");</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>renderWindowInteractor->Start();</div>
<br>
<p></p>
<p>I am using win10, vtk6.3 on vc2013. </p>
<p><br>
</p>
<p>Any tips would be appreciated.</p>
<p><br>
</p>
<p>Cheers,</p>
<p><br>
</p>
<p>Chiang</p>
</div>
</div>
</div>
</div>
</body>
</html>