# Question: how to place the camera to make sure snapshot the whole dataset in python script (NOT in GUI)

**URL:** https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789
**Category:** ParaView Support
**Created:** [October 17, 2019, 1:41am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789 "2019-10-17T01:41:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Robinnie](https://discourse.paraview.org/user_avatar/discourse.paraview.org/robinnie/32/1913_2.png) [@Robinnie](https://discourse.paraview.org/u/Robinnie)
#### Post date: [October 17, 2019, 1:41am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/1 "2019-10-17T01:41:02Z")

</div>

I am using python script to snapshot the 3D datasets. A lot of datasets. It seems the camera position/placement, etc will affect the snapshot(it may snapshot the whole dataset, or just part of it) as shown as the attached picture. The 4 pictures are actually using 2 sets of parameters to blindly snapshot the datasets (parameters are from the tracing python script for the 1st data in paraview GUI ).

I checked and found different dataset size will have different camera position/placement parameter as below lines shown to make sure snapshot the whole dataset, while I can not figure out how to calculate these parameters based on the dataset size (and maybe the window size?)

```
# current camera placement for renderView1

renderView1.CameraPosition = [-553.2213163882634, 1225.361636475504, 1340.9145427277479]

renderView1.CameraFocalPoint = [249.5, 249.5, 249.5]

renderView1.CameraViewUp = [0.2719455703783571, 0.8080929324180035, -0.5225240849259124]

renderView1.CameraParallelScale = 432.1466764884349

```

My question: how to calculate the cameral placement parameters according to the dataset size, in order to make sure snapshot the whole dataset?

 ![1571275307420_3d](https://discourse.paraview.org/uploads/default/original/2X/b/bc8b6e0f333d9d94e447108a381d4e4685a28c43.jpeg) ![1571275218727_3d](https://discourse.paraview.org/uploads/default/original/2X/7/70c6587d1fcdb2e806ec121860a3a1ff164bc3a0.jpeg) ![1571273537225_3d](https://discourse.paraview.org/uploads/default/original/2X/3/36b05bb230e9e013eda9ad3d0ea3c537df318de6.jpeg) ![1571244296837_3d](https://discourse.paraview.org/uploads/default/original/2X/5/58f1b0c49bce8fbffbb23ca57fc8c794f9005d58.jpeg)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 17, 2019, 2:05am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/2 "2019-10-17T02:05:27Z")

</div>

what about `ResetCamera()` ?

---

<div class="post-metadata">

### Author: ![Robinnie](https://discourse.paraview.org/user_avatar/discourse.paraview.org/robinnie/32/1913_2.png) [@Robinnie](https://discourse.paraview.org/u/Robinnie)
#### Post date: [October 17, 2019, 2:09am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/3 "2019-10-17T02:09:44Z")

</div>

renderView1.ResetCamera() does not do the job:(  
It was in my script already.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 17, 2019, 2:11am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/4 "2019-10-17T02:11:15Z")

</div>

It should.  
Can you share a simple script that shows this behavior ?

---

<div class="post-metadata">

### Author: ![Robinnie](https://discourse.paraview.org/user_avatar/discourse.paraview.org/robinnie/32/1913_2.png) [@Robinnie](https://discourse.paraview.org/u/Robinnie)
#### Post date: [October 17, 2019, 2:17am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/5 "2019-10-17T02:17:36Z")

</div>

I realized my mistakes. I was using the tracing script and put the `enderView1.ResetCamera()` before the  
# current camera placement for renderView1

```
renderView1.CameraPosition = [-553.2213163882634, 1225.361636475504, 1340.9145427277479]

renderView1.CameraFocalPoint = [249.5, 249.5, 249.5]

renderView1.CameraViewUp = [0.2719455703783571, 0.8080929324180035, -0.5225240849259124]

renderView1.CameraParallelScale = 432.1466764884349

```

Which make make the ResetCamera() not working.  
When I add another `enderView1.ResetCamera()` before snap, my problem solved.

Thanks a lot. Mr. Mathieu WestPhal. It is relief as I don’t need to calculate those parameters…

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [October 17, 2019, 2:26am UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/6 "2019-10-17T02:26:59Z")

</div>

There is a small section on camera controls in the Sandia National Laboratory Tutorials, available from the ParaView Help menu. Look at ParaView and Python. Link is: [https://www.paraview.org/Wiki/ParaView\_and\_Python#Control\_the\_camera](https://www.paraview.org/Wiki/ParaView_and_Python#Control_the_camera)

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [October 17, 2019, 1:45pm UTC](https://discourse.paraview.org/t/question-how-to-place-the-camera-to-make-sure-snapshot-the-whole-dataset-in-python-script-not-in-gui/2789/7 "2019-10-17T13:45:56Z")

</div>

Tools … Start Trace is your friend 🙂 . I think you want to use the ‘resetCamera’ button, which will be recorded as a command you can use in your Python script.  
HTH,

Aron
