make_gif()
Assemble a directory of PNG frames into a looping GIF.
Usage
make_gif(
frame_dir,
output,
width,
height,
first_duration=1,
frame_duration=0.4,
last_duration=4
)Frames are read in file name order, so name them 0001.png, 0002.png, and so on. The first and last frames get their own hold times.
Parameters
frame_dir: str or pathlib.Path-
Directory holding the
.pngframes. output: str or pathlib.Path-
Path for the
.giffile. width: int-
GIF size in pixels. Frames are resized to fit.
height: int-
GIF size in pixels. Frames are resized to fit.
first_duration: float = 1-
Seconds to hold the first frame.
frame_duration: float = 0.4-
Seconds to show each middle frame.
last_duration: float = 4- Seconds to hold the last frame.
Returns
pathlib.Path- The output path.
Raises
FileNotFoundError-
If
frame_dirhas no PNG files.