[vtk-developers] PNG problem

victor sv victorsv at gmail.com
Tue Mar 1 03:00:16 EST 2016


Hi all,

I get a black picture when exporting the screen using
vtkwindowtoimagefilter with any supported format (jpg, png, bmp, tiff)

My SO is an Ubuntu 14.04 with VTK v5.8 and I'm using the python bindings
for VTK.

The solution proposed by Joachim works for me:

pRenderWindow.Render()
windowToImageFilter.ReadFrontBufferOff()
windowToImageFilter.Update()

This issue does not appear in all VTK versions and I'm not able to identify
the source of the poblem ... Any suggestion?

I dont understand what ReadFrontBufferOff() does. Anyone can explain why i
need to do that?

Thanks in advance,
Víctor


2015-07-24 10:24 GMT+02:00 Joachim Pouderoux <joachim.pouderoux at kitware.com>
:

> Could you try to add a pRenderWindow->Render(); before calling
> windowToImageFilter->Update(); ?
> Do that and try with and ReadFrontBufferOff() and then with
> ReadFrontBufferOn().
>
>
> Joachim
>
> *Joachim Pouderoux*
>
> *PhD, Technical Expert*
> *Kitware SAS <http://www.kitware.fr>*
>
>
> 2015-07-24 9:44 GMT+02:00 Manole Buican <manole.buican at terrasigna.com>:
>
>> Hi Joachim,
>>
>>
>>
>> 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.
>>
>>
>>
>> Thx,
>>
>> Manole
>>
>>
>> ------------------------------
>> *From:* Joachim Pouderoux [joachim.pouderoux at kitware.com]
>> *Sent:* Wednesday, July 22, 2015 6:08 PM
>>
>> *To:* Manole Buican
>> *Cc:* vtk-developers at vtk.org
>> *Subject:* Re: [vtk-developers] PNG problem
>>
>> Can you try to add windowToImageFilter->ReadFrontBufferOff(); before
>> calling Update()?
>>
>> *Joachim Pouderoux*
>>
>> *PhD, Technical Expert*
>> *Kitware SAS <http://www.kitware.fr>*
>>
>>
>> 2015-07-22 17:07 GMT+02:00 Manole Buican <manole.buican at terrasigna.com>:
>>
>>> Hi Joachim
>>>
>>>
>>>
>>> It's a valid white file.
>>>
>>>
>>>
>>> Manole
>>>
>>>
>>> ------------------------------
>>> *From:* Joachim Pouderoux [joachim.pouderoux at kitware.com]
>>> *Sent:* Wednesday, July 22, 2015 6:05 PM
>>> *To:* Manole Buican
>>> *Cc:* vtk-developers at vtk.org
>>> *Subject:* Re: [vtk-developers] PNG problem
>>>
>>> Hi Manole,
>>>
>>> Is the the 2KB PNG file valid and defines an empty/all black image ?
>>>
>>> Joachim
>>>
>>> *Joachim Pouderoux*
>>>
>>> *PhD, Technical Expert*
>>> *Kitware SAS <http://www.kitware.fr>*
>>>
>>>
>>> 2015-07-22 16:47 GMT+02:00 Manole Buican <manole.buican at terrasigna.com>:
>>>
>>>> Hi all,
>>>>
>>>> Code like
>>>>
>>>> void DlgResVis2D::saveTmpPicture(QString &filename)
>>>> {
>>>>         vtkNew<vtkWindowToImageFilter> windowToImageFilter;
>>>>         vtkWindow* pRenderWindow = (vtkWindow *)
>>>> m_pView->GetRenderWindow();
>>>>
>>>>         windowToImageFilter->SetInput(pRenderWindow);
>>>>         windowToImageFilter->SetMagnification(1);
>>>>         windowToImageFilter->SetInputBufferTypeToRGBA();
>>>>         windowToImageFilter->Update();
>>>>
>>>>         vtkSmartPointer <vtkPNGWriter> writer = vtkSmartPointer
>>>> <vtkPNGWriter>::New();
>>>>         writer->SetFileName(filename.toAscii());
>>>>
>>>> writer->SetInputConnection(windowToImageFilter->GetOutputPort());
>>>>         writer->Write();
>>>> }
>>>>
>>>> exports a picture in PNG on 5 computers. On the sixth computer produce
>>>> only a 2KB empty PNG file (no error is prompted), while on each other
>>>> 5 computers produce 35KB PNG file with the same image.
>>>> Does anybody encounter the same behavior?
>>>>
>>>> Thx in advance,
>>>> Manole Buican
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Search the list archives at:
>>>> http://markmail.org/search/?q=vtk-developers
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>>
>>>>
>>>>
>>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160301/efc315ec/attachment.html>


More information about the vtk-developers mailing list