WebpReplay
A class for handling WebP replay animations
A class for handling WebP replay animations.
This class provides functionality to work with WebP replay animations, including saving, extracting frames, and displaying the animation. It’s particularly useful for handling browser session replays and screenshots.
Args: replay: The WebP animation data as bytes.
Methods
display
Display the WebP replay in the current environment
Returns:
The displayed image object if in a notebook, None otherwise.
frame
Extract a specific frame from the WebP animation
Parameters:
frame_idx
: Index of the frame to extract. Can be negative to count from the end.
Returns:
The extracted frame as a PIL Image object.
in_notebook
Check if the code is running in a Jupyter notebook environment
Returns:
True if running in a notebook, False otherwise.
save
Save the WebP replay to a file
Parameters:
output_file
: Path where to save the WebP file. Must end with .webp extension.
Raises:
ValueError
: If the output file doesn’t have a .webp extension.
save_frame
Save a specific frame from the WebP animation as a PNG file
Parameters:
frame_idx
: Index of the frame to save. Can be negative to count from the end.output_file
: Path where to save the PNG file. The extension will be changed to .png if needed.
Module
notte_core.utils.webp_replay