title: Why is my Gif file created by PIL so large?
body: <p>I used Python's PIL(Pillow) to create more than 100 images, when I save these images separately as JPEG files, each take about 10KB. </p>
  
  <pre><code>im.save("frame%d.jpg" % idx, "JPEG")
  </code></pre>
  
  <p>But if I merge these images into a Gif file, the file takes close to 20MB!</p>
  
  <pre><code># sequence is list of all images [im1, im2 ...]
  gif = Image.new("P", (w, h))
  gif.save("result.gif", save_all=True, append_images=sequence, duration=100, optimize=True) # 10fps
  </code></pre>
  
  <p>Why is this? And how could I compress the gif file to take much less space?</p>