gif_patch
Swaps colors across all GIF color tables and adjusts frame delays, with exact match reporting and quantized timing.
Instructions
Operations on animated GIFs. 'palette' swaps colours in every colour table (global AND per-frame local — patching only the global table is a classic half-fix) without touching frame data: zero generation loss, every frame changes in perfect sync — the correct way to re-dress an indexed sprite. The response reports how many table entries each source colour actually matched; 0 means that hex isn't in the file (use colors_inspect to find the exact hexes). 'retime' re-times all frames to msPerFrame. GIF delays are quantised to 10ms steps with a 20ms minimum; pixels survive a decode/re-encode that is exact up to 255 opaque colours (beyond that, nearest-palette snapping). Real bug this fixes: an animation authored at 1.8s being cut off by game code that frees the sprite after 0.62s — retime the GIF instead of dropping frames.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ||
| action | Yes | ||
| outFile | Yes | ||
| colorMap | No | for 'palette': { fromHex: toHex, ... } | |
| msPerFrame | No | for 'retime': delay per frame in ms (quantised to 10ms steps, min 20ms) |