Screenshot from camera POV using Python

I’m trying to take a picture from the point of view of a camera in the game without adjusting the viewport (just like what you see when you select the camera during editing).

I have tried using take_automation_screenshot_at_camera but can’t work out what it wants for the latent_info arg, so haven’t got that working.

I tried take_high_res_screenshot passing in my camera as an option, but it adjusted the viewport and the picture was not of what the camera was looking at.

Even better would be if I could do it in memory so that I don’t need to write the output to file.

Any assistance would be greatly appreciated.

maybe you can try to pilot that camera, take SS and eject the camera

It seems like take_high_res_screenshot() defaults to the player controller view, since it’s used for automation testing. In my usage, I found that it completely ignored passing in a camera actor to it (like you found also).

However, I did find that I could use something like this first to cast the view of that camera target onto the player controller, then that screenshot function worked as expected.

e.g.
player_controller.set_view_target_with_blend(camera_actor) # NOTE: Only need to set the player view to the camera actor’s view once, this setting sticks