Skip to content

Video editing with Python

Change gif encoding to use modern imageio pillow and remove useless args

osaajanid72ac0c97b86
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index 4af8051f..47fcce81 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -460,9 +460,7 @@ class VideoClip(Clip):
self,
filename,
fps=None,
- opt="nq",
loop=0,
- colors=None,
logger="bar",
):
"""Write the VideoClip to a GIF file.
@@ -480,16 +478,9 @@ class VideoClip(Clip):
isn't provided, then the function will look for the clip's
``fps`` attribute (VideoFileClip, for instance, have one).
- opt
- Optimalization to apply. If program='imageio', opt must be either 'wu'
- (Wu) or 'nq' (Neuquant).
-
loop : int, optional
Repeat the clip using ``loop`` iterations in the resulting GIF.
- colors : int, optional
- Defines the maximum number of colors that the output image will have.
-
progress_bar
If True, displays a progress bar
@@ -512,9 +503,7 @@ class VideoClip(Clip):
self,
filename,
fps=fps,
- opt=opt,
loop=loop,
- colors=colors,
logger=logger,
)
diff --git a/moviepy/video/io/gif_writers.py b/moviepy/video/io/gif_writers.py
index ba8992c1..26cdcbf3 100644
--- a/moviepy/video/io/gif_writers.py
+++ b/moviepy/video/io/gif_writers.py
@@ -7,20 +7,14 @@ import imageio
@requires_duration
@use_clip_fps_by_default
def write_gif_with_imageio(
- clip, filename, fps=None, opt=0, loop=0, colors=None, logger="bar"
+ clip, filename, fps=None, loop=0, logger="bar"
):
"""
Writes the gif with the Python library ImageIO (calls FreeImage).
"""
- if colors is None:
- colors = 256
logger = proglog.default_bar_logger(logger)
- quantizer = 0 if opt != 0 else "nq"
-
- writer = imageio.save(
- filename, duration=1.0 / fps, quantizer=quantizer, palettesize=colors, loop=loop
- )
+ writer = imageio.save(filename, duration=1.0 / fps, loop=loop)
logger(message="MoviePy - Building file %s with imageio." % filename)
for frame in clip.iter_frames(fps=fps, logger=logger, dtype="uint8"):