code: def save_as_gif(self, gif_path, duration=0.25):
          
  
          import imageio
          gif_data = [img for img in self.get_slices()]
          # using img.astype(np.uint32) is leaving noticable artefacts,
          #   depending on imageio inner conversion, which is rescaling okay
  
          # TODO deal with differing sizes of slices, padding with zeros or white??
  
          with warnings.catch_warnings():
              # ignoring the warning for conversion to uint8
              warnings.simplefilter('ignore')
              imageio.mimsave(gif_path, gif_data, duration=duration)
docs: Package the selected slices into a single GIF for easy sharing and display (on web etc).
  
          You must install imageio module separately to use this feature.
  
          Parameters
          ----------
          gif_path : str
              Output path for the GIF image
  
          duration : float
              Duration of display of each frame in GIF, in sec.