def write_gif_with_image_io(clip, filename, fps=None, opt='wu', loop=0, colors=None, verbose=True):
 if (colors is None):
  colors = 256
 if (not IMAGEIO_FOUND):
  raise ImportError("Writing a gif with imageio requires ImageIO installed, with e.g. 'pip install imageio'")
 if (fps is None):
  fps = clip.fps
 quantizer = ('wu' if (opt != 'nq') else 'nq')
 writer = imageio.save(filename, duration=(1.0 / fps), quantizer=quantizer, palettesize=colors)
 verbose_print(verbose, ('\n[MoviePy] Building file %s with imageio\n' % filename))
 for frame in clip.iter_frames(fps=fps, progress_bar=True, dtype='uint8'):
  writer.append_data(frame)

def write_gif_with_image_io ( clip , filename , fps = None , opt = 'wu' , loop = 0 , colors = None , verbose = True ) : if ( colors is None ) : colors = 256 if ( not IMAGEIO_FOUND ) : raise ImportError ( "Writing a gif with imageio requires ImageIO installed, with e.g. 'pip install imageio'" ) if ( fps is None ) : fps = clip . fps quantizer = ( 'wu' if ( opt != 'nq' ) else 'nq' ) writer = imageio . save ( filename , duration = ( 1.0 / fps ) , quantizer = quantizer , palettesize = colors ) verbose_print ( verbose , ( '\n[MoviePy] Building file %s with imageio\n' % filename ) ) for frame in clip . iter_frames ( fps = fps , progress_bar = True , dtype = 'uint8' ) : writer . append_data ( frame )
writes the gif with the python library imageio .