pyvista.Plotter.open_gif

pyvista.Plotter.open_gif#

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

Open a gif file.

Requires imageio to be installed.

Parameters:
filenamestr | Path

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

loopint, default: 0

The number of iterations. Default value of 0 loops indefinitely.

fpsfloat, default: 10

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

palettesizeint, default: 256

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

subrectanglesbool, default: False

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

Note

Setting this to True may help reduce jitter in colorbars.

**kwargsdict, optional

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

Notes

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

Examples

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

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

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