Commit 67bf8eb1 authored by Lucas Bourneuf's avatar Lucas Bourneuf

bugfix: gif not generated properly ; loop argument

parent aa8c2ec1
......@@ -32,13 +32,13 @@ def single_image_from_filenames(fnames:[str], outfile:str=None, dotfile:str=None
return compile_to_single_image(final_context, outfile=outfile, dotfile=dotfile, return_image=return_image, verbosity=verbosity)
def gif_from_filenames(fnames:[str], giffile:str=None, dotfile_template:str=None, duration:int=1000, verbosity:int=0) -> bytes or str:
def gif_from_filenames(fnames:[str], giffile:str=None, dotfile_template:str=None, duration:int=1000, loop:int=0, verbosity:int=0) -> bytes or str:
"""Make a gif, with each ASP model as an image. Save it in outfile and dotfile_template"""
pipeline = build_pipeline(fnames, verbosity)
final_context = run(pipeline, verbosity=verbosity)
first, *lasts = compile_to_images(final_context, dotfile_template=dotfile_template, return_image=True, verbosity=verbosity)
output = io.BytesIO() if giffile is None else giffile
first.save(output, save_all=True, append_images=lasts, duration=duration, loop=0)
first.save(output, format='gif', append_images=lasts, duration=duration, loop=loop, save_all=True)
return output.getvalue() if giffile is None else giffile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment