Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python ImageIO Gif Set Delay Between Frames

I am using ImageIO: https://imageio.readthedocs.io/en/latest/userapi.html , and I want to know how to set delay between frames in a gif.

Here are the relevant parts of my code.

import imageio 
. . . 
imageio.mimsave(args.output + '.gif', ARR_ARR)

where ARR_ARR is an array of numpy uint8 2d array of couplets.

To be clear, I have no problem writing the gif. I cannot, however, find any clarification on being able to write the amount of delay between frames.

So, for example, I have frames 0 ... 9

They always play at the same rate. I would like to be able to control the number of milliseconds or whatever unit between frames being played.

like image 760
Cade Brown Avatar asked Sep 19 '16 20:09

Cade Brown


1 Answers

Found it using imageio.help("GIF") you would pass in something like

imageio.mimsave(args.output + '.gif', ARR_ARR, fps=$FRAMESPERSECOND)

And that seems to work.

like image 149
Cade Brown Avatar answered Sep 28 '22 04:09

Cade Brown