Commit 41a86c8
authored
Experimental python API for taking viewer screenshots (#12405)
### Related
* Fixes #2305
* it's not perfect, comes with #12481
* #12482
### What
Users long wanted to programmatically write out screenshots from Rerun for all sort of purposes. This is now possible!
Usage
```py
"""Take screenshots of the viewer or specific views from code."""
import rerun as rr
import rerun.blueprint as rrb
from rerun.experimental import ViewerClient
# Setup a viewer with a known blueprint.
rr.init("rerun_example_screenshot", spawn=True)
rr.connect_grpc()
view = rrb.Spatial3DView(name="my blue 3D", background=[100, 149, 237])
rr.send_blueprint(rrb.Blueprint(view, collapse_panels=True))
# Connect to a local viewer.
viewer = ViewerClient()
# Screenshot the entire viewer.
viewer.save_screenshot("entire_viewer.jpg")
# Screenshot only the view we created earlier.
viewer.save_screenshot("my_view.png", view_id=view.id)
```
https://github.com/user-attachments/assets/ddb7d0dd-574a-4412-9c8e-3eabf77ad482
To make this _really_ useful a few more things need to be done - future work:
* allow blocking on when the screenshot is done
* improve `send_blueprint` ergonomics a little bit
* provide an example screenshotting out a camera path (needs above items)
* not directly related but makes this much more powerful: allow setting time cursor from viewer client
* work with a windows-less (headless) viewer
* address views by name rather than id (best effort?)
Draft TODOs:
* [x] a few code todos
* [x] take uuid argument on view_id so we don't have to call `str(view.id)`
* [x] put the above snippet into some docs
* [x] make future work items an issue, check if #2305 is really to be closed fully already and whether there's other issues
Source-Ref: 0bb67f5af9231fc6e1f599d4c9f49e72906914bd1 parent c9372b1 commit 41a86c8
File tree
17 files changed
+438
-44
lines changed- crates
- store
- re_grpc_server/src
- re_log_channel
- src
- re_protos
- proto/rerun/v1alpha1
- src/v1alpha1
- viewer
- re_test_context/src
- re_viewer_context
- src
- re_viewer/src
- docs/snippets
- all/howto
- rerun_py
- rerun_bindings
- src
17 files changed
+438
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9076 | 9076 | | |
9077 | 9077 | | |
9078 | 9078 | | |
| 9079 | + | |
9079 | 9080 | | |
9080 | 9081 | | |
9081 | 9082 | | |
| |||
10444 | 10445 | | |
10445 | 10446 | | |
10446 | 10447 | | |
| 10448 | + | |
10447 | 10449 | | |
10448 | 10450 | | |
10449 | 10451 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
416 | 418 | | |
417 | 419 | | |
418 | 420 | | |
| |||
474 | 476 | | |
475 | 477 | | |
476 | 478 | | |
477 | | - | |
478 | 479 | | |
479 | 480 | | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
| 485 | + | |
484 | 486 | | |
485 | 487 | | |
486 | 488 | | |
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
| 493 | + | |
491 | 494 | | |
492 | 495 | | |
493 | 496 | | |
| |||
504 | 507 | | |
505 | 508 | | |
506 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
507 | 516 | | |
508 | 517 | | |
509 | 518 | | |
| |||
611 | 620 | | |
612 | 621 | | |
613 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
614 | 626 | | |
615 | 627 | | |
616 | 628 | | |
| |||
826 | 838 | | |
827 | 839 | | |
828 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
829 | 845 | | |
830 | 846 | | |
831 | 847 | | |
| |||
869 | 885 | | |
870 | 886 | | |
871 | 887 | | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
872 | 892 | | |
873 | 893 | | |
874 | 894 | | |
| |||
884 | 904 | | |
885 | 905 | | |
886 | 906 | | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
887 | 911 | | |
888 | 912 | | |
889 | 913 | | |
| |||
893 | 917 | | |
894 | 918 | | |
895 | 919 | | |
| 920 | + | |
896 | 921 | | |
897 | 922 | | |
898 | 923 | | |
| |||
905 | 930 | | |
906 | 931 | | |
907 | 932 | | |
| 933 | + | |
908 | 934 | | |
909 | 935 | | |
910 | 936 | | |
| |||
982 | 1008 | | |
983 | 1009 | | |
984 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
985 | 1025 | | |
986 | 1026 | | |
987 | 1027 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
80 | 105 | | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments