<div dir="ltr"><div><div><div>Hi all,<br><br></div>I get a black picture when exporting the screen using vtkwindowtoimagefilter with any supported format (jpg, png, bmp, tiff)<br><br></div>My SO is an Ubuntu 14.04 with VTK v5.8 and I'm using the python bindings for VTK.<br><br></div>The solution proposed by Joachim works for me:<br><br><div><span>pRenderWindow.Render()</span><br><span><span>windowToImageFilter.</span>ReadFrontBufferOff()</span><br><span>windowToImageFilter.Update()<br><br></span></div><div><span>This issue does not appear in all VTK versions and I'm not able to identify the source of the poblem ... Any suggestion?<br></span></div><div><span><br></span></div><div><span>I dont understand what ReadFrontBufferOff() does. Anyone can explain why i need to do that?<br><br></span></div><div><span>Thanks in advance,<br></span></div><div><span>Víctor<br></span></div><span></span><br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-24 10:24 GMT+02:00 Joachim Pouderoux <span dir="ltr"><<a href="mailto:joachim.pouderoux@kitware.com" target="_blank">joachim.pouderoux@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><span>Could you try to add a pRenderWindow->Render(); before calling </span><br><span>windowToImageFilter->Update(); ?<br></span></div><span>Do that and try with and </span><span>ReadFrontBufferOff() and then with </span><span>ReadFrontBufferOn().<span class="HOEnZb"><font color="#888888"><br><br><br></font></span></span></div><span class="HOEnZb"><font color="#888888"><div><span>Joachim</span></div><span></span></font></span></div><div class="gmail_extra"><span class=""><br clear="all"><div><div><div dir="ltr"><b>Joachim Pouderoux</b><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font size="1"><i>PhD, Technical Expert</i></font><br><b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br></blockquote>
</div></div></div>
<br></span><div><div class="h5"><div class="gmail_quote">2015-07-24 9:44 GMT+02:00 Manole Buican <span dir="ltr"><<a href="mailto:manole.buican@terrasigna.com" target="_blank">manole.buican@terrasigna.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<p>Hi Joachim,</p>
<p> </p>
<p>I tried what you suggested, but.. the same results. The system involved is a machine with Genuine Intel (R) CPU, U7300 @ 1.3 GHz, RAM 4 GB, Win 7, 64 bits and Mobile Intel(R) 4 Series Express Chipset Family video card.</p>
<p> </p>
<p>Thx,</p>
<p>Manole</p>
<p> </p>
<div style="FONT-SIZE:16px;FONT-FAMILY:Times New Roman;COLOR:#000000">
<hr>
<div style="DIRECTION:ltr"><font face="Tahoma" size="2" color="#000000"><span><b>From:</b> Joachim Pouderoux [<a href="mailto:joachim.pouderoux@kitware.com" target="_blank">joachim.pouderoux@kitware.com</a>]<br>
</span><b>Sent:</b> Wednesday, July 22, 2015 6:08 PM<div><div><br>
<b>To:</b> Manole Buican<br>
<b>Cc:</b> <a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
<b>Subject:</b> Re: [vtk-developers] PNG problem<br>
</div></div></font><br>
</div><div><div>
<div></div>
<div>
<div dir="ltr">Can you try to add <span>windowToImageFilter->ReadFrontBufferOff(); before calling Update()?
</span></div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr"><b>Joachim Pouderoux</b><br>
<blockquote style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:rgb(204,204,204) 1px solid">
<font size="1"><i>PhD, Technical Expert</i></font><br>
<b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br>
</blockquote>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2015-07-22 17:07 GMT+02:00 Manole Buican <span dir="ltr">
<<a href="mailto:manole.buican@terrasigna.com" target="_blank">manole.buican@terrasigna.com</a>></span>:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">
<div>
<div style="FONT-SIZE:10pt;FONT-FAMILY:Tahoma;COLOR:#000000;DIRECTION:ltr">
<p>Hi Joachim</p>
<p> </p>
<p>It's a valid white file.</p>
<p> </p>
<p>Manole</p>
<p> </p>
<div style="FONT-SIZE:16px;FONT-FAMILY:Times New Roman;COLOR:#000000">
<hr>
<div style="DIRECTION:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Joachim Pouderoux [<a href="mailto:joachim.pouderoux@kitware.com" target="_blank">joachim.pouderoux@kitware.com</a>]<br>
<b>Sent:</b> Wednesday, July 22, 2015 6:05 PM<br>
<b>To:</b> Manole Buican<br>
<b>Cc:</b> <a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
<b>Subject:</b> Re: [vtk-developers] PNG problem<br>
</font><br>
</div>
<div>
<div>
<div></div>
<div>
<div dir="ltr">
<div>Hi Manole,<br>
<br>
Is the the 2KB PNG file valid and defines an empty/all black image ?<br>
<br>
</div>
Joachim<br>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr"><b>Joachim Pouderoux</b><br>
<blockquote style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:rgb(204,204,204) 1px solid">
<font size="1"><i>PhD, Technical Expert</i></font><br>
<b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br>
</blockquote>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2015-07-22 16:47 GMT+02:00 Manole Buican <span dir="ltr">
<<a href="mailto:manole.buican@terrasigna.com" target="_blank">manole.buican@terrasigna.com</a>></span>:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">
<div>
<div style="FONT-SIZE:10pt;FONT-FAMILY:Tahoma;COLOR:#000000;DIRECTION:ltr">
Hi all, <br>
<br>
<span>Code like </span><br>
<br>
<span>void DlgResVis2D::saveTmpPicture(QString &filename) </span><br>
<span>{ </span><br>
<span>        vtkNew<vtkWindowToImageFilter> windowToImageFilter; </span><br>
<span>        vtkWindow* pRenderWindow = (vtkWindow *) m_pView->GetRenderWindow();
</span><br>
<br>
<span>        windowToImageFilter->SetInput(pRenderWindow); </span><br>
<span>        windowToImageFilter->SetMagnification(1); </span><br>
<span>        windowToImageFilter->SetInputBufferTypeToRGBA(); </span><br>
<span>        windowToImageFilter->Update(); </span><br>
<br>
<span>        vtkSmartPointer <vtkPNGWriter> writer = vtkSmartPointer <vtkPNGWriter>::New();
</span><br>
<span>        writer->SetFileName(filename.<span>toAscii</span>()); </span><br>
<span>        writer->SetInputConnection(windowToImageFilter->GetOutputPort()); </span>
<br>
<span>        writer->Write(); </span><br>
<span>} </span><br>
<br>
<span><span>exports</span> a picture in <span>PNG</span> on 5 computers. On the sixth computer produce only a 2KB empty
<span>PNG</span> file (no error is prompted), while on each other 5 computers produce 35KB
<span>PNG</span> file with the same <span>image</span>. </span><br>
<span>Does anybody encounter the same behavior? </span><br>
<br>
<span>Thx in advance, </span><br>
<span>Manole Buican </span><br>
</div>
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">
http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br></div>