[vtkusers] Saving PNG file without rendering window
So Drafts
soichirowv at gmail.com
Mon Feb 4 03:05:19 EST 2013
Guys,
I am trying to render images of just simple shapes and
save the png files of them.
In that process, I do not want to open any rendering windows
on screen.
The python script I am trying is as follows.
by using this script, I found a png file is successfuly created,
but a rendering window appears for only a moment.
Does anyone know how to modify this script to hide the rendering windows?
thank you in advance,
So
------------(from here)-----------------------
import vtk
cone = vtk.vtkConeSource()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(cone.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren = vtk.vtkRenderer()
ren.AddActor(actor)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.Render()
w2if = vtk.vtkWindowToImageFilter()
w2if.SetInput(renWin)
writer = vtk.vtkPNGWriter()
writer.SetInputConnection(w2if.GetOutputPort())
writer.SetFileName('output.png')
writer.Write()
------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130204/dafe5278/attachment.htm>
More information about the vtkusers
mailing list