Cross-fade Two GIFs
Cross-fade two GIF animations with adjustable blend duration. Upload two GIFs, set transition frames, preview and download the merged result.
About
Merging two GIF animations with a smooth cross-fade requires frame-level pixel interpolation. Each frame from GIF A in the transition zone is blended with the corresponding frame from GIF B using a linear alpha factor t that progresses from 0 to 1. A miscalculated blend produces visible banding, frame-rate mismatches, or color table corruption. This tool decodes both GIF files at the binary level (GIF89a spec with LZW decompression), performs per-pixel interpolation across the transition region, and re-encodes the result as a valid GIF. Output dimensions match the larger of the two inputs. Frame delays are preserved from source animations and averaged during the crossfade zone.
Limitations: transparency in source GIFs is flattened to a white matte before blending. Very large GIFs (exceeding 500 frames total or 20MB file size) may strain browser memory. The crossfade duration is specified in number of frames, not milliseconds, giving precise control over the transition length. Pro tip: for the smoothest result, use source GIFs with similar frame rates and canvas dimensions.
Formulas
Each pixel in the crossfade zone is computed by linear interpolation between the corresponding pixels of GIF A and GIF B:
where the blend factor t for frame index i within the crossfade region of n total blend frames is:
where cout = output pixel channel value (R, G, or B), cA = pixel channel from GIF A frame, cB = pixel channel from GIF B frame, t = interpolation factor (0 = fully A, 1 = fully B), i = current frame index within the crossfade zone, n = total number of crossfade frames. The operation is applied independently to each of the three color channels (Red, Green, Blue) and clamped to the integer range [0, 255].
Reference Data
| Parameter | Description | Typical Range | Default |
|---|---|---|---|
| Crossfade Frames | Number of frames in the blend zone | 2 - 60 | 10 |
| Frame Delay | Time per frame in the GIF | 20 - 200ms | Source value |
| GIF89a Header | Magic bytes: 47 49 46 38 39 61 | - | - |
| LZW Min Code Size | Initial dictionary bit width | 2 - 8 bits | Derived from color depth |
| Max Color Table | Global Color Table entries | 2 - 256 | 256 |
| Disposal Method 0 | No disposal specified | - | Leave as-is |
| Disposal Method 1 | Do not dispose | - | Keep frame |
| Disposal Method 2 | Restore to background | - | Clear canvas |
| Disposal Method 3 | Restore to previous | - | Revert canvas |
| Max Output Width | Largest width of both inputs | 1 - 2048px | Auto |
| Max Output Height | Largest height of both inputs | 1 - 2048px | Auto |
| Loop Count | Netscape extension loop value | 0 (infinite) - 65535 | 0 |
| Blend Formula | Per-channel linear interpolation | - | c = a(1โt) + bยทt |
| Quantization | Median-cut color reduction to 256 | - | Applied per frame |