# Capture 3D view into PNG file with transparent background not working as expected

**URL:** https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740
**Category:** Support
**Tags:** mri, python, screen-capture
**Created:** [June 7, 2022, 12:18am UTC](https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740 "2022-06-07T00:18:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![aliabidi](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@aliabidi](https://discourse.slicer.org/u/aliabidi)
#### Post date: [June 7, 2022, 12:18am UTC](https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740/1 "2022-06-07T00:18:14Z")

</div>

I have a 3D image which I want to take a screenshot of, I do not want to have the background or the axes (I, R, S) or purple lines when I save the image. The current state looks as follows:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/c/0c8dd06f606648907770515265df1c29b4db11ec.jpeg)

I have run the ‘[Capture 3D view into PNG file with transparent background](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#capture-3d-view-into-png-file-with-transparent-background)’ script by saving it in a Python file and then running `exec(open('./Users/me/Downloads/save.py').read())` in the Python console in Slicer (see screenshot).

However, the screenshot which is output does not have the current 3D view, and does not have a 3D background or hidden axes:

 ![screenshot](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/5/5522b8d091e6d813c0b11a61da52066643cb70be.jpeg)

What can I do about this?

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [June 7, 2022, 9:13am UTC](https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740/2 "2022-06-07T09:13:33Z")

</div>

You need to ise the orthogonal prpjection

---

<div class="post-metadata">

### Author: ![aliabidi](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@aliabidi](https://discourse.slicer.org/u/aliabidi)
#### Post date: [June 7, 2022, 12:14pm UTC](https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740/3 "2022-06-07T12:14:37Z")

</div>

Sorry I’m a bit new to this software- what does this mean?

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [June 7, 2022, 12:23pm UTC](https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740/4 "2022-06-07T12:23:31Z")

</div>

Click on the pin icon on the upper left view and click where there is a cubb  
Let me know if that helps

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [June 7, 2022, 12:54pm UTC](https://discourse.slicer.org/t/capture-3d-view-into-png-file-with-transparent-background-not-working-as-expected/23740/5 "2022-06-07T12:54:14Z")

</div>

You can configure the view with something like this:

```auto
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetBackgroundColor((0,0,0))
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetBackgroundColor2((0,0,0))
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetBoxVisible(False)
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetAxisLabelsVisible(False)

```
