Change Colors in a GIF
Change, shift, or replace colors in animated GIF files. Adjust hue, saturation, brightness, swap specific colors, or apply filters to every frame.
Drop your GIF here or click to browse
Max 20 MB · Animated GIF only
About
Modifying colors in an animated GIF requires decoding every frame from the GIF89a binary format, decompressing LZW-encoded pixel data, transforming each pixel in a chosen color space, then re-encoding the entire sequence. A single mishandled disposal method or local color table will corrupt every subsequent frame. This tool parses the raw binary structure, extracts frames with correct timing and disposal, applies color transformations in HSL space for perceptually uniform shifts, and re-encodes with proper GCT palettes. Tolerance-based color replacement uses Euclidean distance d = βΞR2 + ΞG2 + ΞB2 in RGB space to catch neighboring shades. Note: heavily dithered GIFs with limited 256-color palettes may show banding after aggressive hue shifts. Transparency frames are preserved but disposal method βrestore to backgroundβ may produce artifacts on GIFs that rely on frame stacking.
Formulas
Hue shifting operates in HSL color space. Each pixel's RGB values are converted, the hue channel is rotated, then converted back.
Hnew = (Horiginal + ΞH) mod 360Β°
For targeted color replacement, the Euclidean distance in RGB space determines pixel eligibility:
d = β(R1 β R2)2 + (G1 β G2)2 + (B1 β B2)2
A pixel is replaced when d β€ T (tolerance). Maximum possible distance is β3 Γ 2552 β 441.7. Grayscale conversion uses the luminance formula per ITU-R BT.709:
L = 0.2126R + 0.7152G + 0.0722B
Where R, G, B are the pixel's red, green, blue channel values (0 - 255). H is hue in degrees (0 - 360). ΞH is the user-specified hue rotation. T is the color match tolerance. d is the Euclidean distance between the target and pixel color.
Reference Data
| Color Operation | Color Space | Best For | Limitation |
|---|---|---|---|
| Hue Shift | HSL | Global color theme change | Grays unaffected (saturation β 0) |
| Saturation Adjust | HSL | Vivid β muted tones | Clipping at 0 or 100% |
| Brightness Adjust | HSL | Lighten or darken | Destroys detail at extremes |
| Color Replace | RGB | Swap specific color | Needs tolerance for anti-aliased edges |
| Invert | RGB | Negative effect | Transparency unchanged |
| Grayscale | RGB (luminance) | Remove all color | Irreversible once saved |
| Sepia | RGB (matrix) | Vintage/warm tone | Shifts blues to brown |
| Channel Isolate (R) | RGB | Red channel only | Loses all non-red info |
| Channel Isolate (G) | RGB | Green channel only | Loses all non-green info |
| Channel Isolate (B) | RGB | Blue channel only | Loses all non-blue info |
| Threshold | Luminance | Black & white cutoff | Loses gradients entirely |
| Posterize | RGB | Reduce color levels | Banding artifacts |
| Temperature Shift | RGB (R/B bias) | Warm/cool tone | Can clip channels |
| Tint Overlay | RGB blend | Uniform color wash | Reduces contrast |