Skip to content

Commit 566bd8b

Browse files
t-makarojklymak
authored andcommitted
endless looping GIFs with PillowWriter (#11789)
* add loop kwarg to PillowWriter Adds an optional parameter to PillowWriter that will set the number of times that a gif should loop for. Defaults to 0 meaning endless * next_whats_new file for endless gifs * adjust PillowWriter loop kwarg * add docstring to PillowWriter * ValueError if loop is not an int in PillowWriter * remove API changes * fix typo * kill docstring for now
1 parent 4e9b699 commit 566bd8b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:orphan:
2+
3+
Endless Looping GIFs with PillowWriter
4+
--------------------------------------
5+
6+
We acknowledge that most people want to watch a gif more than once. Saving an animation
7+
as a gif with PillowWriter now produces an endless looping gif.

lib/matplotlib/animation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def grab_frame(self, **savefig_kwargs):
562562
def finish(self):
563563
self._frames[0].save(
564564
self._outfile, save_all=True, append_images=self._frames[1:],
565-
duration=int(1000 / self.fps))
565+
duration=int(1000 / self.fps), loop=0)
566566

567567

568568
# Base class of ffmpeg information. Has the config keys and the common set

0 commit comments

Comments
 (0)