Screenshots
With Panopti you can capture screenshots directly from the interactive viewer (using the screenshot UI button), or programmatically like so:
import panopti
viewer = panopti.connect(server_url="http://localhost:8080", viewer_id='client')
# Frame your shot:
viewer.set_camera(
position=(5.0, 2.5, 7.5),
target=(0.0, 1.5, 0.0),
projection_mode="orthographic"
)
# Take screenshot
img_arr = viewer.screenshot(filename='screenshot.png',
bg_color=(0.75, 0.3, 0.3)) # use bg_color=None for fully transparent background
viewer.hold()
Screenshot - viewer.screenshot()
Capture a screenshot from the frontend viewer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str or None
|
If provided, the image will be saved to this path. Supported extensions are |
None
|
bg_color
|
tuple or None
|
Background color as RGB values in [0,1] range. |
None
|
timeout
|
float
|
How long to wait for the screenshot data from the frontend. Default is 2 seconds. |
2.0
|
Returns:
Type | Description |
---|---|
Optional[ndarray]
|
np.ndarray or None: RGB/RGBA image array, or |