How create visualization from terminal

Hi everyone,
I have several data files and I would like to produce an image from every file. I can generate a visualization state, pvsm, and use it for everyfile but it takes time. Is it possible from the terminal to apply the visualization to all the files and and save an image for every file? The data are binary data that I load as raw binary files and then inside the properties I set the data extent.

Thank you

This is a perfect case to use Python scripting. Please have a look at section 1.6 in the ParaView Guide for an introduction. Information about Python scripting is woven throughout the guide as well.

Thanks for the reply. I have tried to trace the actions and got a python script. It does almost the job but the final image is 400x400 pixels even though I have selected 1517x920 during the tracing. The orientation axes and the center apperas but I have removed that during the tracing. Addittonaly the color I have selected for the isosurface is replaced with the default color. Do you know how to solve this two problems?

I copy also the python script

try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

vof0765000_3d_bin = ImageReader( FilePrefix='/scratch/fdv/emulsions/bande/collision/phi20/vof0765000_3d.bin' )

RenderView1 = GetRenderView()
DataRepresentation1 = Show()
DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]
DataRepresentation1.SelectionPointFieldDataArrayName = 'ImageFile'
DataRepresentation1.ScalarOpacityUnitDistance = 2.4461839185154535
DataRepresentation1.Representation = 'Outline'
DataRepresentation1.ScaleFactor = 79.9

vof0765000_3d_bin.DataScalarType = 'double'
vof0765000_3d_bin.DataByteOrder = 'LittleEndian'
vof0765000_3d_bin.DataExtent = [1, 800, 1, 800, 1, 160]

RenderView1.CenterOfRotation = [399.5, 399.5, 79.5]

Contour1 = Contour( PointMergeMethod="Uniform Binning" )

RenderView1.CameraPosition = [399.5, 399.5, 2283.913734232235]
RenderView1.CameraFocalPoint = [399.5, 399.5, 79.5]
RenderView1.CameraClippingRange = [2024.164596889913, 2436.6274402457184]
RenderView1.CameraParallelScale = 570.544257704869

Contour1.PointMergeMethod = "Uniform Binning"
Contour1.ContourBy = ['POINTS', 'ImageFile']
Contour1.Isosurfaces = [0.4999999970872426]

DataRepresentation2 = Show()
DataRepresentation2.ScaleFactor = 79.9
DataRepresentation2.SelectionPointFieldDataArrayName = 'Normals'
DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]

RenderView1.Background2 = [0.0, 0.0, 0.16470588235294117]
RenderView1.Background = [1.0, 1.0, 1.0]

DataRepresentation1.AmbientColor = [0.0, 0.0, 0.0]

WriteImage('/scratch/fdv/emulsions/bande/collision/phi20/4.png')

Delete(PointMergeMethod)
Delete(DataRepresentation1)
Delete(DataRepresentation2)
Delete(Contour1)
Delete(vof0765000_3d_bin)
Delete(RenderView1)
Render()

Thank you

Try adding something like

RenderView1.ViewSize = [1517, 920]

There is a hint to that effect in scripts written from ParaView 5.5.2. (You did not specify the version you were using.)

Additionally, newer versions of ParaView have a SaveScreenshot function (which replaces WriteImage). This new function also allows you to specify the image resolution of the file being written out.

SaveScreenshot('/scratch/fdv/emulsions/bande/collision/phi20/4.png',
               ImageResolution=(1517, 920))

Thanks! It works. Do you know also how I can remove orientation axes and the center or where I can read about it? I am using paraview version 4.0.1

There are a few gaps here and there in the Python tracing (fewer in newer versions of ParaView, 4.0.1 is fairly old at this point), which perhaps explains why your orientation and center axes visibility change was not recorded. In ParaView 5.5.2, I ran a trace and got the following:

# Hide orientation axes
renderView1.OrientationAxesVisibility = 0

# Hide center axes
renderView1.CenterAxesVisibility = 0

That should work in 4.0.1, though I haven’t tried it.

Thanks! That worked!