# How to wait for take\_high\_res\_screenshot?

**URL:** <https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [March 4, 2020, 10:16am UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285 "2020-03-04T10:16:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![batman2142](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@batman2142](https://forums.unrealengine.com/u/batman2142)\
**Post date:** [March 4, 2020, 10:16am UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/1 "2020-03-04T10:16:33Z")

</div>

I have a script that takes a screenshot using

```auto

screenshotTask = unreal.AutomationLibrary.take_high_res_screenshot(SCREEN_X, SCREEN_Y, screenshotPath)

```

How do I wait for screenshotTask.is\_task\_done() to become true?

---

<div class="post-metadata">

**Author:** ![Andreas\_Ranman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Andreas\_Ranman](https://forums.unrealengine.com/u/Andreas_Ranman)\
**Post date:** [March 5, 2020, 1:17pm UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/2 "2020-03-05T13:17:14Z")

</div>

Think the file should be accessible the very next line, the limitation I found is mostly that you can only make one capture this frame. We implemented something like a ‘coroutine’ in our python bridge a function that would allow us to in python yield result per frame,

```auto

for x in range(10):
  # capture screen, and edit settings for next frame, 
  yield WaitForNextFrame

```

---

<div class="post-metadata">

**Author:** ![NoobNotPro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoobNotPro](https://forums.unrealengine.com/u/NoobNotPro)\
**Post date:** [September 16, 2020, 11:37pm UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/4 "2020-09-16T23:37:59Z")

</div>

I noticed that on\_tick waits for texture streaming causing hiccups and skips a few screenshots, but pre\_tick does the work here is updated version

```auto

import unreal

class capture(object):
  def __init__ (self):
    unreal.EditorLevelLibrary.editor_set_game_view(True)
    self.actors = (actor for actor in unreal.EditorLevelLibrary.get_selected_level_actors())
    self.on_pre_tick = unreal.register_slate_pre_tick_callback(self. __pretick__ )

  def __pretick__ (self, deltatime):
    try:
      actor = next(self.preactors)
      shot_name = actor.get_name()
      unreal.EditorLevelLibrary.pilot_level_actor(actor)
      unreal.AutomationLibrary.take_high_res_screenshot(1920,1080, shot_name + ".png")
      unreal.EditorLevelLibrary.eject_pilot_level_actor()
    except Exception as error:
      print(error)
      unreal.unregister_slate_pre_tick_callback(self.on_pre_tick)

```

---

<div class="post-metadata">

**Author:** ![Evan\_Tseng](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/evan_tseng/32/935410_2.png) [@Evan\_Tseng](https://forums.unrealengine.com/u/Evan_Tseng)\
**Post date:** [September 19, 2022, 1:16am UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/5 "2022-09-19T01:16:08Z")

</div>

Hello,  
What do you mean by “WaitForNextFrame”, is it a specific function that you use?  
Thanks

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_08d548b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08d548b6](https://forums.unrealengine.com/u/anonymous_user_08d548b6)\
**Post date:** [November 27, 2022, 8:01pm UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/6 "2022-11-27T20:01:42Z")

</div>

Hi,  
How can we take depth screenshot with python api’s???

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_08d548b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08d548b6](https://forums.unrealengine.com/u/anonymous_user_08d548b6)\
**Post date:** [November 27, 2022, 8:05pm UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/7 "2022-11-27T20:05:02Z")

</div>

what is the difference between 2 API’s

1. unreal.AutomationLibrary.take\_high\_res\_screenshot
2. unreal.AutomationLibrary.take\_automation\_screenshot\_at\_camera

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_08d548b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_08d548b6](https://forums.unrealengine.com/u/anonymous_user_08d548b6)\
**Post date:** [November 27, 2022, 8:05pm UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/8 "2022-11-27T20:05:22Z")

</div>

Can we have python script to take depth screenshot?

---

<div class="post-metadata">

**Author:** ![Andreas\_Ranman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Andreas\_Ranman](https://forums.unrealengine.com/u/Andreas_Ranman)\
**Post date:** [January 10, 2023, 10:31am UTC](https://forums.unrealengine.com/t/how-to-wait-for-take-high-res-screenshot/139285/9 "2023-01-10T10:31:24Z")

</div>

You could use a post process material for the render, SceneTexture has SceneDepth and CustomDepth and guess all GBuffers ( if you are working with deferred and not forward )
