open_gif#
- Plotter.open_gif(filename, loop=0, fps=10, palettesize=256, subrectangles=False, **kwargs)[source]#
Open a gif file.
- Parameters:
- filename
str
Filename of the gif to open. Filename must end in
"gif"
.- loop
int
,optional
The number of iterations. Default 0 (meaning loop indefinitely).
- fps
float
,optional
The number of frames per second. If duration is not given, the duration for each frame is set to 1/fps. Default 10.
- palettesize
int
,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. DefaultFalse
.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 >>> pl = pyvista.Plotter() >>> pl.open_gif('movie.gif', fps=8, palettesize=64)
See Create a GIF Movie for a full example using this method.