[vtkusers] saving rendered images
Oliver Vidovic
ovidovic at medipattern.com
Thu Mar 21 11:51:04 EST 2002
>
> Szender <szenderb at bu.edu> wrote:
> I am working with some in house code that utilizes the vtk to render a 3-d
> graphic. We want to export images for use in Flash and need a fast way to
> save the rendered image. Are there any good routines for doing this sort
> of file saving?
>
> Thanks,
> JBS
>
Hi,
Here's what I've done when I needed such functionality. The code is in TCL.
# get what's on renderer
vtkRendererSource renSrc
renSrc SetInput renderer
renSrc WholeWindowOn
# save the frame
vtkBMPWriter writer
writer SetInput [renSrc GetOutput]
writer SetFileName "frame.bmp"
writer Write
Putting this code into a procedure and calling it every time the vtkCamera
moves, did the work for me.
Note: Watch out, so that the window where the scene is being rendered is
not covered with other windows, cursor or OS dialogs... It looks like
vtkRendererSource captures the screen as input. Once I had a cursor on the
vtk window, and it was captured also into a saved bitmap.
thanks
oliver
More information about the vtkusers
mailing list