Plotter.open_gif(filename, loop=0, fps=10, palettesize=256, subrectangles=False, **kwargs)[source]#

Open a gif file.


Filename of the gif to open. Filename must end in "gif".

loopint, optional

The number of iterations. Default 0 (meaning loop indefinitely).

fpsfloat, optional

The number of frames per second. If duration is not given, the duration for each frame is set to 1/fps. Default 10.

palettesizeint, optional

The number of colors to quantize the image to. Is rounded to the nearest power of two. Must be between 2 and 256. Default 256.

subrectanglesbool, optional

If True, will try and optimize the GIF by storing only the rectangular parts of each frame that change with respect to the previous. Default False.


Setting this to True may help reduce jitter in colorbars.

**kwargsdict, optional

See the documentation for imageio.get_writer() for additional kwargs.


Consider using pygifsicle to reduce the final size of the gif. See Optimizing a GIF using pygifsicle.


Open a gif file, setting the framerate to 8 frames per second and reducing the colorspace to 64.

>>> import pyvista
>>> pl = pyvista.Plotter()
>>> pl.open_gif('movie.gif', fps=8, palettesize=64)  

See Create a GIF Movie for a full example using this method.