py5_tools.capture_frames()

Capture frames from a running Sketch.

Examples

1
2
3
4
5
import py5_tools

py5.run_sketch()
# capture 10 frames from the currently running sketch
frames = py5_tools.capture_frames(10, period=1)

Description

Capture frames from a running Sketch.

By default the Sketch will be the currently running Sketch, as returned by get_current_sketch(). Use the sketch parameter to specify a different running Sketch, such as a Sketch created using Class mode.

If your Sketch has a post_draw() method, use the hook_post_draw parameter to make this function run after post_draw() instead of draw(). This is important when using Processing libraries that support post_draw() such as Camera3D or ColorBlindness.

Syntax

capture_frames(count: float, *, period: float = 0.0, sketch: Sketch = None, hook_post_draw: bool = False) -> List[PIL.Image]

Parameters

  • count: float - number of Sketch snapshots to capture

  • hook_post_draw: bool = False - attach hook to Sketch’s post_draw method instead of draw

  • period: float = 0.0 - time in seconds between Sketch snapshots (default 0 means no delay)

  • sketch: Sketch = None - running Sketch

Updated on September 11, 2021 16:51:34pm UTC