title: add background to a gif containing images of different sizes (R magick)
body: <p>I would like to add an image background to a gif which contains images of different sizes like this beautiful christmas ball.</p>
  
  <p><a href="https://i.stack.imgur.com/pSLOj.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pSLOj.gif" alt="enter image description here"></a></p>
  
  <p>Here is the code i tried : </p>
  
  <pre><code>  #install.packages("magick")
    library(magick)
    setwd("C:/Users/...")
    christmas &lt;- image_read('christmas.gif')
    background &lt;- image_blank(250, 250, color = "red")
    frames &lt;- image_composite(background, christmas, offset = "+0+0")
    animation &lt;- image_animate(frames, fps = 5)
    image_write(animation, "output.gif", format="gif")
  </code></pre>
  
  <p>And here is the horrible result !!</p>
  
  <p><a href="https://i.stack.imgur.com/8XeS4.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8XeS4.gif" alt="enter image description here"></a></p>
  
  <p>The problem is that the 3 images of the ball gif are not of the same size so the images are moving when adding a background image. </p>
  
  <pre><code>      &gt; christmas
        format width height colorspace matte filesize
        1    GIF   216    249       sRGB  TRUE    47656
        2    GIF   202    233       sRGB  TRUE    47656
        3    GIF   200    214       sRGB  TRUE    47656
  </code></pre>
  
  <p>I didn't find how to fix this problem... : If you could help me before christmas it would be great !!! </p>
  
  <p>Thanks !</p>