pyvista.Plotter.open_gif#
- Plotter.open_gif(
- filename,
- loop=0,
- fps=10,
- palettesize=256,
- subrectangles=False,
- **kwargs,
Open a gif file.
Requires
imageio
to be installed.- Parameters:
- filename
str
|Path
Filename of the gif to open. Filename must end in
"gif"
.- loop
int
, default: 0 The number of iterations. Default value of 0 loops indefinitely.
- fps
float
, default: 10 The number of frames per second. If duration is not given, the duration for each frame is set to 1/fps.
- palettesize
int
, 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.- **kwargs
dict
,optional
See the documentation for
imageio.get_writer()
for additional kwargs.
- filename
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.