[vtkusers] Transparency in screenshot

Dženan Zukić dzenanz at gmail.com
Tue Feb 1 03:35:48 EST 2011


Thanks a lot, that was it, the missing piece.

Dženan

2011/1/31 David Gobbi <david.gobbi at gmail.com>

> 2011/1/31 Dženan Zukić <dzenanz at gmail.com>:
> > Hi all,
> > I have a problem with saving transparency from a screenshot into a file.
> > unsigned char
> > *pixDebug=vis->GetRenderWindow()->GetRGBACharPixelData(0,0,512,512,1);
> > //pixDebug contains alpha channel (determined by manual inspection of
> array
> > in debugger)
> > vtkWindowToImageFilter *windowGrabber=vtkWindowToImageFilter::New();
> > windowGrabber->SetInput(vis->GetRenderWindow()); //vis is a QVTK
> component
> > vtkPNGWriter *writer=vtkPNGWriter::New();
> > writer->SetInput(windowGrabber->GetOutput());
> > writer->SetFileName(filename.c_str());
> > writer->Write(); //file does not have alpha channel
> > Do you have any suggestions?
>
> Try this: windowGrabber->SetInputBufferTypeToRGBA();
>
>  - David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110201/82751eb7/attachment.htm>


More information about the vtkusers mailing list