[vtkusers] Save qvtkwidget image

Gib Bogle g.bogle at auckland.ac.nz
Sat May 28 17:31:12 EDT 2011


I'm using QVTKWidget, and want to save the image.  Clearly I don't have much 
understanding of it, but I have code that at least produces an image file:

     vtkSmartPointer<vtkTIFFWriter> writer = vtkTIFFWriter::New();
     vtkRenderWindow *renWin = qvtkWidget->GetRenderWindow();
     vtkWindowToImageFilter *w2img = vtkWindowToImageFilter::New();
     w2img->SetInput(renWin);
     writer->SetFileName(qPrintable(filename));
     w2img->SetMagnification(10);
     writer->SetInputConnection(w2img->GetOutputPort());
     w2img->Modified();
     writer->Write();

How should I control the size of the image?  If I do not set the magnification, 
I get an image 100x30, regardless of the size of the MDI window.  And why does 
it always have an aspect ratio of 3.33?  E.g., with the code shown, the image is 
1000x300.

Thanks
Gib



More information about the vtkusers mailing list