title: Is it possible to generate a gif animation using pillow library only?
body: <p>I want to be able to transform numpy arrays into images. First, I have learned how to transform a 3D (<code>hight x width x color</code>) array into an image. After some research it looks to me that PIL (or Pillow) is the most natural way to do it. This is how I do it at the moment (and it works fine):</p>
  
  <pre><code>from PIL import Image
  import numpy as np
  
  if __name__ == '__main__':
      h = 4
      w = 8
      arr = np.zeros((h,w,3), dtype=np.uint8)
  
      arr[0, 0, :] = [255,255,0]
      arr[3, 7, :] = [0,255,0]
  
      img = Image.fromarray(arr, 'RGB')
      img.save('viz.png')
  </code></pre>
  
  <p>As a next step, I want to be able to take a list of 3D array (or a 4D array, where time is the additional dimension) and generate the corresponding animation. So, far I did not find how to do it.</p>
  
  <p>It looks like Pillow is able to read gif-animation. Using ImageSequence we can access its frames. However, I cannot find out how one can put a sequence of images into animation.</p>
  
  <p>I saw some solutions that use <code>ìmages2gif</code> but I would like to stay withing a single library.</p>
  
  <p><strong>ADDED</strong></p>
  
  <p>The answers <a href="https://stackoverflow.com/questions/24688802/saving-an-animated-gif-in-pillow">here</a> do not answer my question. They use <code>gifmaker</code> library that I cannot even install by pip.</p>