Staaarter

GIF Edge Refiner

Uploads an animated GIF and smooths jagged (aliased) alpha edges on every frame using a small edge-aware blur confined strictly to the alpha transition zone, leaving flat interior and background areas untouched, then re-encodes and downloads the result. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
editoredgesanimationcanvasgiftransparency

Overview

Introduction

This tool smooths jagged, staircase-like alpha edges on every frame of an animated GIF, entirely client-side, using a small blur confined strictly to the alpha transition zone.

It's designed to fix the hard, aliased edges that GIF's binary (fully-transparent or fully-opaque) alpha model tends to produce, without touching flat interior or background areas.

What Is GIF Edge Refiner?

A client-side GIF edge-smoothing tool that detects, per frame, which pixels sit directly on a hard alpha boundary (a neighbor is fully transparent while the pixel itself is opaque, or vice versa) and averages their alpha and premultiplied color over a small neighborhood, producing a genuinely anti-aliased edge instead of a jagged one.

Pixels that aren't on a transition (the vast majority of a typical frame) are left completely untouched.

How GIF Edge Refiner Works

For each pixel, its 3x3 neighborhood is checked for any neighbor whose 'is fully transparent' status differs from its own; if so, it's classified as an edge pixel.

Edge pixels have their alpha and color averaged (weighted by neighbor alpha, to avoid dark color fringes from formerly-transparent neighbors) over a `radius`-sized window, then this smoothed value replaces the original hard-cutoff value.

When To Use GIF Edge Refiner

Use it on a GIF whose silhouette looks visibly 'staircased' or pixelated along curved or diagonal edges, often a side effect of GIF's hard alpha cutoff during encoding.

It's also a good pre-processing step before adding an outline or stroke, since a smoother source edge produces a smoother outline.

Features

Advantages

  • Only touches genuine transition pixels, leaving flat areas completely unaffected.
  • Produces a subtler, more natural-looking result than a full-image blur.
  • Runs entirely client-side; the uploaded animation is never sent to a server.

Limitations

  • Can't fully undo aggressive aliasing from a very low-resolution source; there's only so much a small local blur can recover.
  • Doesn't address GIF's limited color palette: only the alpha edge's smoothness is improved.

Examples

Smooth a pixelated circular badge

Input

A 100x100 animated GIF of a rotating badge with visibly jagged round edges, radius 2

Output

A 100x100 animated GIF with the same badge, now with softly anti-aliased edges instead of a staircase pattern

Only the boundary pixels around the badge's silhouette are touched; the badge's interior colors and the background stay unchanged.

Best Practices & Notes

Best Practices

  • Start with a radius of 1 or 2; larger values can start to soften genuinely intended sharp corners.
  • Apply this before an outline, stroke, or background-removal pass, since a cleaner source edge improves those downstream operations.
  • Compare the result against the original at 100% zoom, since the effect is subtle by design.

Developer Notes

refineGifEdges in gif-edge-refiner.ts maps refineFrameEdges (a pure per-pixel edge classifier plus a bounded, alpha-weighted neighborhood average) across every frame of a DecodedGif. This is intentionally a different algorithm from gif-edge-feather.ts (which creates a deliberate distance-based fade) and gif-edge-cleaner.ts (which only snaps near-threshold alpha values, never blurring or blending color); all three address a different edge-quality problem.

GIF Edge Refiner Use Cases

  • Smoothing a visibly jagged or 'staircased' silhouette edge left over from GIF's hard alpha cutoff
  • Preparing a cleaner source edge before adding an outline or stroke
  • Improving the visual quality of a small or low-resolution animated icon's edges

Common Mistakes

  • Expecting a large visual change: this tool is intentionally subtle and localized to genuine transition pixels.
  • Using a very large radius and losing fine silhouette detail as a side effect.

Tips

  • If you want a deliberate, visible soft fade instead of subtle anti-aliasing, use the GIF Edge Feather tool instead.
  • Run the GIF Edge Cleaner afterward if the source also has stray semi-transparent fringe pixels unrelated to genuine jaggies.

References

Frequently Asked Questions