title: How to add image on gif using Pillow?
body: <p>Actually I am doing some experiments with python but I came to the point where I want to add an image on a transparent GIF with dimensions of the image.</p>
  <p>I am getting an error of <code>bad transparency mask</code>.
  Code -</p>
  <pre><code>from PIL import Image, ImageSequence
  background = Image.open(...)
  animated_gif = Image.open(...)
  
  frames = []
  for frame in ImageSequence.Iterator(animated_gif):
  frame = frame.copy()
  
  frame.paste(background, mask=bg)
  frames.append(frame)
  frames[0].save('output.gif', save_all=True, append_images=frames[1:])
  </code></pre>