[vtkusers] JPG file

Renato Cesar Pompeu rcpompeu at hotmail.com
Thu May 13 15:17:12 EDT 2010


I had seen this example before and I'm trying to do something equivalent to the Borland but is not working. Any ideas?

 

...

vtkSphereSource *sphereVmax = vtkSphereSource::New();
    sphereVmax->SetThetaResolution(15);
    sphereVmax->SetPhiResolution(15);
    sphereVmax->SetRadius(0.5);


 

vtkPolyDataMapper *sphereMapperVmax = vtkPolyDataMapper::New();
    sphereMapperVmax->SetInput(sphereVmax->GetOutput());
    sphereMapperVmax->ImmediateModeRenderingOn();

 

vtkActor *sphereActorVmax = vtkActor::New();
    sphereActorVmax->SetMapper(sphereMapperVmax);
    sphereActorVmax->GetProperty()->SetColor(0.9, 0.6, 0.1);
    sphereActorVmax->GetProperty()->SetAmbient(0.2);
    sphereActorVmax->GetProperty()->SetDiffuse(0.3);
    sphereActorVmax->GetProperty()->SetSpecular(0.8);


 

VTK->GetRenderer()->AddActor(sphereActorVmax);    // (VTK is a BorlandRenderWindow) 


 

vtkWindowToImageFilter *image = vtkWindowToImageFilter::New();
        image->SetInput(VTK->GetRenderWindow());    // (I know the problem is here, but I can not solve it)
        image->SetMagnification(6);
        image->Update();

 

vtkJPEGWriter *png = vtkJPEGWriter::New();
        png->SetFileName("screenshot.jpg");
        png->SetInput(image->GetOutput());
        png->Write();

...


Thanks again.


 
> Date: Thu, 13 May 2010 14:41:43 -0400
> Subject: Re: [vtkusers] JPG file
> From: drescherjm at gmail.com
> To: rcpompeu at hotmail.com
> CC: vtkusers at vtk.org
> 
> On Thu, May 13, 2010 at 2:32 PM, Renato Cesar Pompeu
> <rcpompeu at hotmail.com> wrote:
> > Hi,
> >
> > How can I save the contents of a VTK window to a image file?
> >
> > Thanks.
> >
> 
> http://www.itk.org/Wiki/VTK/Examples/Utilities/Screenshot
> 
> Replace the PNG writer with a JPG writer..
> 
> John
 		 	   		  
_________________________________________________________________
VOCÊ PODE TER 25 GB GRATUITOS PARA ARMAZENAR SEUS ARQUIVOS NA WEB. VEJA AQUI COMO.
http://www.windowslive.com.br/public/product.aspx/view/1?cname=skydrive&ocid=Hotmail:MSN:Messenger:Tagline:1x1:skydrive:-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100513/14ec49f9/attachment.htm>


More information about the vtkusers mailing list