# Fit image exactly into renderWindow

**URL:** https://discourse.vtk.org/t/fit-image-exactly-into-renderwindow/4232
**Category:** Development
**Created:** [September 17, 2020, 12:23am UTC](https://discourse.vtk.org/t/fit-image-exactly-into-renderwindow/4232 "2020-09-17T00:23:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Seekerp](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@Seekerp](https://discourse.vtk.org/u/Seekerp)
#### Post date: [September 17, 2020, 12:23am UTC](https://discourse.vtk.org/t/fit-image-exactly-into-renderwindow/4232/1 "2020-09-17T00:23:41Z")

</div>

Hi guys. I am following the following VTK example to take a screenshot of my current volume. [https://vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot](https://vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot).

However, the screenshot always comes with added whitespace on either side (see attached). Is there a way to make the window fit the image exactly?

![VTK_Examples_Baseline_Utilities_TestSingleScreenshot](https://discourse.vtk.org/uploads/default/original/2X/e/e77896784ca7d16f48a53126ea4aa6649de3ff30.png)

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 17, 2020, 2:48pm UTC](https://discourse.vtk.org/t/fit-image-exactly-into-renderwindow/4232/2 "2020-09-17T14:48:48Z")

</div>

The documentation for `SetViewAngle()` in vtkCamera says to use this view angle:

```auto
angle = 2*atan((h/2)/d)

```

Here `h` is the height of the object and `d` is the distance to the camera. For this to work with VTK, you must express the angle in degrees (not radians).

If you are using a parallel projection (`camera->ParallelProjectionOn()`) then instead of using `SetViewAngle()` you must use `SetParallelScale(h/2)`.
