class_docstr: Class that for helping write the animated GIF file. This is based on
  code from images2gif.py (part of visvis). The version here is modified
  to allow streamed writing.
class_docstr_tok: ["Class","that","for","helping","write","the","animated","GIF","file",".","This","is","based","on","code","from","images2gif.py","(","part","of","visvis",")",".","The","version","here","is","modified","to","allow","streamed","writing","."]
code: def add_image(self, im, duration, dispose):
      # Prepare image
      im_rect, rect = im, (0, 0)
      if self.opt_subrectangle:
          im_rect, rect = self.getSubRectangle(im)
      im_pil = self.converToPIL(
          im_rect, self.opt_quantizer, self.opt_palette_size
      )
  
      # Get pallette - apparently, this is the 3d element of the header
      # (but it has not always been). Best we've got. Its not the same
      # as im_pil.palette.tobytes().
      from PIL.GifImagePlugin import getheader
  
      palette = getheader(im_pil)[0][3]
  
      # Write image
      if self._count == 0:
          self.write_header(im_pil, palette, self.opt_loop)
          self._global_palette = palette
      self.write_image(im_pil, palette, rect, duration, dispose)
      # assert len(palette) == len(self._global_palette)
  
      # Bookkeeping
      self._previous_image = im
      self._count += 1
  
file_path: imageio/imageio/plugins/pillowmulti.py
imports: import logging
  import numpy
  from .pillow_legacy import PillowFormat, image_as_uint, ndarray_to_pil
label_desc: Use image node_id 2 for calling the GifWriter obj's underlying member method code with example usage: obj.add_image(im, duration, dispose) without return types