Staaarter

GIF Compositor

Uploads a background GIF and an overlay GIF and composites the overlay's frames on top of the background's frames at a chosen pixel offset, alpha-blending per pixel, looping whichever GIF is shorter so the combined animation matches the longer one's frame count. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
compositingediting

Overview

Introduction

Layering two animations together, like a reaction sticker over a background loop, needs per-frame compositing rather than just placing two files side by side. This tool merges two GIFs into one, with the overlay's transparency respected at every frame.

Both files are decoded, composited, and re-encoded entirely in your browser.

What Is GIF Compositor?

A two-input GIF compositor: you upload a background GIF and an overlay GIF, choose a pixel offset for the overlay, and the tool merges both animations frame by frame into one new GIF.

It uses standard alpha-over compositing, the same blending rule browsers and image editors use for layering semi-transparent content.

How GIF Compositor Works

Both GIFs are decoded into fully composited RGBA frames. The output frame count is the longer of the two GIFs' frame counts; whichever GIF is shorter has its frame index wrapped with modulo arithmetic so it loops to fill the remaining frames.

For each output frame, the overlay frame is alpha-composited onto the background frame at the chosen offset, clipping any part that falls outside the background's canvas, and the result is re-encoded with the background's frame delays and loop count.

When To Use GIF Compositor

Use it to layer a small animated reaction, badge, or effect on top of a longer background animation.

Use it to combine two independently-created GIF loops into a single composited file rather than juggling two separate assets.

Features

Advantages

  • Respects the overlay's transparency with proper alpha-over blending rather than a flat opaque paste.
  • Automatically handles mismatched frame counts by looping the shorter GIF instead of failing.
  • Position is fully adjustable via a simple pixel offset.

Limitations

  • The overlay's own frame timing isn't preserved independently: every output frame uses the background's delay.
  • Looping the shorter GIF by frame count (not by elapsed time) means playback speed differences between the two source GIFs aren't reconciled.
  • The overlay is placed at a fixed offset for the whole animation; it doesn't move or track anything across frames.

Examples

Overlaying a 4-frame badge on an 12-frame background

Input

Background GIF: 12 frames. Overlay GIF: 4 frames. Offset: x:10, y:10.

Output

A 12-frame combined GIF where the overlay's 4 frames repeat three times (looped) across the background's 12 frames.

The output always matches the longer GIF's frame count; the shorter overlay simply wraps around via modulo indexing.

Best Practices & Notes

Best Practices

  • Use an overlay GIF with genuine transparency (not a solid rectangular background) so the composite looks layered rather than boxy.
  • Match the two GIFs' approximate frame rates if you want their motion to feel synchronized, since delays aren't reconciled automatically.
  • Double-check the offset keeps the overlay's important content within the background's canvas bounds.

Developer Notes

The alpha-over `compositeOver` helper this tool defines is reused directly by both `gif-on-image-compositor.ts` and `image-on-gif-compositor.ts`, so all three compositing tools in this category share one tested blending implementation.

GIF Compositor Use Cases

  • Layering a small animated sticker or reaction over a longer background loop
  • Combining a foreground character animation with a separate background animation
  • Building a composited GIF from two independently produced animated assets

Common Mistakes

  • Uploading an overlay GIF that isn't actually transparent, resulting in it fully covering the background like a solid rectangle.
  • Assuming the overlay's own frame delays are preserved: the combined output always follows the background's timing.

Tips

  • If the overlay's loop feels out of sync, try trimming or padding the source GIFs so their frame counts divide evenly.
  • Preview both source GIFs individually first so you know their canvas sizes before picking an offset.

References

Frequently Asked Questions