[Paraview] PNGwriter
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Tue Jun 12 09:25:18 EDT 2007
Firstly, to change properties on a proxy one must use something as under:
writer.SetFileName("c:\\zPytrhon\\vtk\\jost1.png");
writer.AddToInput(reader)
i.e. property name is prefixed with "Set", "Get", "AddTo", or
"RemoveFrom" (the last two are only used with proxy properties i.e.
properties that take other proxies).
Now, to take a screenshot, one doesn't really need to create the writer.
We can use the API provided by the vtkSMRenderModuleProxy to capture an
image. Following script illustrates the same:
import paraview
# All views are registered in the group "view_modules" with the proxy
# manager. We'll try to locate the current view (assuming there's only
# render view created).
pxm = paraview.pyProxyManager();
iter = pxm.group_iter("view_modules");
activeView = None
for proxy in iter:
if proxy.IsA("vtkSMRenderModuleProxy"):
activeView = proxy
break
if activeView:
activeView.WriteImage("/tmp/foo.png","vtkPNGWriter");
Secondly, for saving big screenshots, unfortunately
vtkSMRenderModuleProxy::WriteImage() does not take a magnification
factor. It provides another method CaptureWindow() which takes
magnification as an argument, but it returns vtkImageData object. Since
any of the vtk writers are not wrapped into python by paraview, on can't
write this image data out. We'll fix that in the next release such
that the magnification can be specified in WriteImage call itself.
Thirdly, to turn visibility of a source created through python on, refer
to the following link:
http://public.kitware.com/pipermail/paraview/2007-June/005182.html
Utkarsh
José María García Pérez wrote:
> I´m new to Paraview. I´m trying to write a script which reads a file and
> then takes a screeshot. I have several questions:
> 1. I don't manage to take a photo.'m trying with this:
> writer = paraview.CreateProxy("writers", "PNGWriter","writers")
> writer.FileName="c:\\zPython\\vtk\\jose1.png"
> writer.Input=reader
>
> 2. I would like to take the screenshot with bigger resolution. I don't
> know if there is something similar to:
> vtkRenderLargeImage
>
> 3. I manage to incorporate what I want to the Pipeline Browser.
> Everything start with Visibility Off. How could I turn it on?
>
> Regards,
> Jose M.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
More information about the ParaView
mailing list