GIF Animation
PreviewProxy supports animated GIF handling with frame range selection via the gif_anim parameter.
Default Behavior
By default, GIF files are processed as a single frame - only the first frame is extracted and returned. To enable animated GIF handling, use the gif_anim parameter.
Processing large animated GIFs (many frames, high resolution) can be CPU and memory intensive. Use TRANSFORM_DISALLOW_LIST=gif_anim to disable this feature if needed.
gif_anim Parameter
The gif_anim parameter selects which frames to include in the output.
| Value | Effect |
|---|---|
all | Include all frames |
N | Include only frame N (1-indexed) |
N-M | Include frames N through M (inclusive) |
-N | Include the last N frames |
Examples
Resize an animated GIF while keeping all frames:
/200x200,gif_anim/https://example.com/anim.gif
Extract frames 1 through 10:
/gif_anim:1-10/https://example.com/anim.gif
Extract only the third frame:
/gif_anim:3/https://example.com/anim.gif
Include the last 5 frames:
/gif_anim:-5/https://example.com/anim.gif
gif_af Parameter
The gif_af (GIF apply-to-frames) parameter controls whether transforms are applied only to the selected frames or to all frames.
| Value | Effect |
|---|---|
false (default) | Only return frames in the gif_anim range |
true | Apply transforms to frames in the gif_anim range, but return all frames |
Example
Apply blur to only the last 5 frames while keeping all frames in the output:
/blur=3,gif_anim:-5,gif_af/https://example.com/anim.gif