ssapy_toolkit.Plots.write_gifs
Functions
|
Write frames to an animated GIF with robust sorting and size normalization. |
- ssapy_toolkit.Plots.write_gifs.write_gif(gif_name: str, frames, fps: int = 30, *, duration: float = None, loop: int = 0, sort_frames: bool = True, warn_on_ambiguous: bool = True, uniform_size: bool = True, target_size: tuple = None, bg_color=(255, 255, 255, 0)) None[source]
Write frames to an animated GIF with robust sorting and size normalization.
- Parameters:
gif_name (str) – Output path ending with .gif
frames (iterable of str/Path or str/Path glob pattern) –
- Either:
a list/iterable of image file paths
a glob pattern like ‘/folder/frame_*.png’
Must resolve to at least 2 frames.
fps (int) – Frames per second (ignored if duration is provided)
duration (float or None) – Seconds per frame. If provided, it overrides fps.
loop (int) – 0 = loop forever; positive integers loop that many times.
sort_frames (bool) – If True, apply natural sort to the input paths.
warn_on_ambiguous (bool) – Emit warnings when sorting is ambiguous.
uniform_size (bool) – If True, all frames are resized/padded to a common size.
target_size ((W, H) or None) – If None, use the size of the first image as the canvas.
bg_color (tuple) – RGBA background for padding (when uniform_size is True).