Save an image from the viewport of a camera in Isaac Sim

Now I have added a camera to the scene, and I can see the viewport of the camera in the GUI, but how can I save the image from the viewport of the camera in python. I’d appreciate it if anyone can teach me.

@1710211475 i am just another user, but you could try looking into the viewport utility:

here’s the viewport API - https://docs.omniverse.nvidia.com/kit/docs/omni.kit.viewport.docs/latest/viewport_api.html#capturing-viewport-frames

in addition, there are few other ways to grab viewport via hotkey/GUI:

1 Like

Here’s the python code to capture the viewport:

from omni.kit.viewport.utility import get_active_viewport, capture_viewport_to_file

vp_api = get_active_viewport()
capture_viewport_to_file(vp_api, r"C:\temp\screenshot.png")
2 Likes