1
0
mirror of synced 2024-09-24 11:28:25 +02:00

Auto-create directories for output files as a convenience.

This commit is contained in:
Jennifer Taylor 2021-06-12 17:16:45 +00:00
parent 6b511e8a53
commit d4e3a25340

View File

@ -643,6 +643,9 @@ def render_path(
)
)
if len(images) > 0:
dirof = os.path.dirname(output)
os.makedirs(dirof, exist_ok=True)
with open(output, "wb") as bfp:
images[0].save(bfp, format=fmt, save_all=True, append_images=images[1:], duration=duration, optimize=True)
@ -670,6 +673,9 @@ def render_path(
):
fullname = f"{filename}-{i:{digits}}{ext}"
dirof = os.path.dirname(fullname)
os.makedirs(dirof, exist_ok=True)
with open(fullname, "wb") as bfp:
img.save(bfp, format=fmt)