# Taking multiple HighResShot from a command line Python script

**URL:** <https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [October 5, 2020, 2:53pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672 "2020-10-05T14:53:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkczar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkczar](https://forums.unrealengine.com/u/darkczar)\
**Post date:** [October 5, 2020, 2:53pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/1 "2020-10-05T14:53:58Z")

</div>

I put these 3 lines in a Python script…

import unreal  
unreal.SystemLibrary.execute\_console\_command(unreal.EditorLevelLibrary.get\_editor\_world(), “HighResShot 2”)  
unreal.SystemLibrary.execute\_console\_command(unreal.EditorLevelLibrary.get\_editor\_world(), “HighResShot 2”)

…and run them from the DOS command line, like this…

D:\UE4Editor.exe “D:\MyProject.uproject” -ExecutePythonScript=“D:\HighResShot\_multi.py”

…and I only get 1 screenshot, instead of the two that I was expecting. Can someone help me make this work? Or explain why it does not work? The log indicates that the command got run twice. The snapshots are not overwriting eachother. I’ve tried explicit naming, and I only get the last one. I am trying to loop over assets and take snapshots. I always get only the last asset.

---

<div class="post-metadata">

**Author:** ![darkczar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkczar](https://forums.unrealengine.com/u/darkczar)\
**Post date:** [October 7, 2020, 1:47pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/2 "2020-10-07T13:47:05Z")

</div>

Note to self: I switched over to doing the same thing in C++, no python, using Editor Scripting Utilities, and the same thing is happening. I am calling

FScreenshotRequest::RequestScreenshot(MyPath, true, true);

from inside a for loop in C++ and I only get the last screenshot that is requested. It seems like the screenshot is taken after the function call is ended.

---

<div class="post-metadata">

**Author:** ![sequencermatt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sequencermatt](https://forums.unrealengine.com/u/sequencermatt)\
**Post date:** [October 7, 2020, 11:18pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/3 "2020-10-07T23:18:57Z")

</div>

The HighResShot command sets a flag for the viewport which is read on the next engine tick. You will need to delay multiple frames between requesting high res shots. To do this via python on the command line you will probably need to hook the slate tick delegate to know when multiple frames have passed. (unreal.register\_slate\_post\_tick\_callback)

---

<div class="post-metadata">

**Author:** ![darkczar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkczar](https://forums.unrealengine.com/u/darkczar)\
**Post date:** [December 10, 2020, 3:20pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/4 "2020-12-10T15:20:11Z")

</div>

Thanks! I just now saw this. I guess I’m not getting notified when people reply on these threads.

I want to take multiple screenshots while NOT playing. I guess I need some python code to simulate a game and tick manually?

---

<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:** [December 10, 2020, 10:16pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/5 "2020-12-10T22:16:43Z")

</div>

[https://forums.unrealengine.com/development-discussion/python-scripting/1679694-python-api-highrescreenshot](https://forums.unrealengine.com/development-discussion/python-scripting/1679694-python-api-highrescreenshot)

---

<div class="post-metadata">

**Author:** ![darkczar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkczar](https://forums.unrealengine.com/u/darkczar)\
**Post date:** [December 10, 2020, 10:50pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/6 "2020-12-10T22:50:25Z")

</div>

Thank you Andreas!!! It works! Wow! I struggled with this for a long time. Thank you!

---

<div class="post-metadata">

**Author:** ![quackaddict7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@quackaddict7](https://forums.unrealengine.com/u/quackaddict7)\
**Post date:** [December 4, 2023, 6:50pm UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/7 "2023-12-04T18:50:07Z")

</div>

Sorry, I know this is old, but I’m having this same problem. @Andreas_Ranman or @darkczar do you remember how you fixed this? The link from Andreas is 404 or private.

---

<div class="post-metadata">

**Author:** ![Edoartworks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Edoartworks](https://forums.unrealengine.com/u/Edoartworks)\
**Post date:** [January 22, 2024, 9:30am UTC](https://forums.unrealengine.com/t/taking-multiple-highresshot-from-a-command-line-python-script/151672/9 "2024-01-22T09:30:27Z")

</div>

I created this tutorial on how to make a tool to do something very similar. Hope it helps!

> **[Taking batch editor screenshots - Icon generator tool | Community tutorial](https://dev.epicgames.com/community/learning/tutorials/7yWD/unreal-engine-taking-batch-editor-screenshots-icon-generator-tool)**
>
> This tool generates textures by taking screenshots of the selected 3D assets. 
> It's split into 3 parts, one is the simple level setup, one is the Editor...

@quackaddict7
