Auto-create directories for output files as a convenience.
This commit is contained in:
parent
6b511e8a53
commit
d4e3a25340
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user