[vtkusers] vtkJPEGWriter not creating file

Kerry Loux louxkr at gmail.com
Sun May 3 21:50:17 EDT 2009


Hello,

I am trying to create a function that writes the contents of my renderwindow
(on screen) to file.  I have tried a method from an old post to this list as
well as a method similar to what is used in the vtkWindowToImageFilter
example (two very similar methods), but in both cases the code executes
without generating the file.  No errors/crashes/warnings or anything like
that, it just doesn't seem to work.  The code I've tried is this:

vtkWindowToImageFilter *WindowToImage = vtkWindowToImageFilter::New();
WindowToImage->SetInput(RenderWindow);
WindowToImage->Update();
Writer = vtkJPEGWriter::New();
Writer->SetQuality(100);
Writer->SetInputConnection(WindowToImage->GetOutputPort());
Writer->SetFileName("test.jpg");
RenderWindow->Render();
Writer->Write();

and this:

vtkWindowToImageFilter *WindowToImage = vtkWindowToImageFilter::New();
WindowToImage->SetInput(RenderWindow);
WindowToImage->Modified();
Writer = vtkJPEGWriter::New();
Writer->SetQuality(100);
Writer->SetInput(WindowToImage->GetOutput());
Writer->SetFileName("test.jpg");
RenderWindow->Render();
Writer->Write();

I've got to be missing something... any ideas?

Thanks,

Kerry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090503/fc97a8c4/attachment.htm>


More information about the vtkusers mailing list