uwefladrich/scriptengine-tasks-ecearth

Fix GIFs only playing once

Closed this issue · 3 comments

I think I found the reason: In the legacy Pillow version of imageio, the default for loop seems to have been 0. Now, they point to the Pillow documentation explicitly for kwargs. There, it says:

loop: Integer number of times the GIF should loop. 0 means that it will loop forever. By default, the image will not loop.

So we should add loop=0 in this line:

imageio.imwrite(dst_folder / gif_file, frames, fps=2)

I reopen this because there is another, related, issue: I think the fps parameter does not work (anymore). For one thing, the animations rush through, it seems much faster than 2 fps. Furthermore, the documentation does not mention fps but duration. Is that another change that comes with the new version?

Talking of the duration parameter: I see in the docs that it is possible to pass a list or tuple to set individual delays. Maybe it would be cool if all frames go with a constant duration (one or two per second) but the last frame stays longer, maybe 5 or 10 seconds? Then it would easier to spot the last year, which is the current state of the experiment.