Save GIF
Turn an image batch into a looping GIF without fighting Pillow
- full_pipe
- image
Save GIF is the pack's animation outlet: take a batch of images (from the pipe, or an optional image input) and write them out as one looping GIF. That's the whole job, and it's a job that's annoyingly easy to get subtly wrong if you hand-roll it with Pillow - banding, color shift between frames, palette explosions. This node handles the palette problem properly, which is the part everyone gets wrong.
It's a plain OUTPUT_NODE - no outputs, just a file on disk. You'd reach for it at the end of any workflow that produces a frame batch: AnimateDiff-ish passes, seed-variation runs you want as an animated flipbook, or upscale variations that you want to scrub through as frames.
How it works
It reads the batch from the pipe's image (or the image input), optionally scales each frame down, then builds a shared palette across all frames combined before quantizing each frame to it. That's the clever bit: if you quantize frames independently, colors shift between frames and the animation flickers. Here the whole batch is pasted side-by-side, quantized once to a single palette (up to gif_quality colors), and each frame is mapped to that same palette - so colors stay consistent through the loop. Then it saves with loop=0 (infinite) and the per-frame frame_duration.
The inputs that matter
- frame_duration - seconds per frame, default 0.15 (≈6.7 fps). For a smooth loop of a simple motion you'll often want 0.1 or lower; for a slow pan, 0.2+.
- scale - 0.1 to 1.0, default 1.0. GIFs are huge and quantization is lossy; scaling a 2K batch down to 50% before encoding is the standard move to keep the file size sane. There's no upscale here - it only shrinks.
- gif_quality - palette size, default 128 (max 256). More colors = less banding but bigger files. Drop to 64–96 for a small preview GIF.
- filename_prefix / path - same variable scheme as the Save node:
%date,%time,%model,%width,%height,%seed.
Installing
Part of the mudknight utils pack. ComfyUI Manager → search comfyui-mudknight-utils, or:
cd ComfyUI/custom_nodes
git clone https://github.com/mudknight/comfyui-mudknight-utils
Restart ComfyUI. No model downloads - it's pure Pillow.
Gotchas
- "No image in pipe" - nothing to save. Wire the
imageinput or make sure the pipe carries a batch. - Band-y sky / skin - that's the 256-color ceiling of GIF, not a bug. Either accept it, lower the resolution with
scale, or save a video instead of a GIF. - Huge output file - GIFs don't compress like PNG/WebP. Drop
gif_qualityto 64–96 and scale to 0.5; the file shrinks dramatically. - Single frame → static image - a one-frame batch technically saves, but you probably meant to feed it a real batch.
Zero impressions on comfy.icu - but if you've ever thrown a frame batch at Pillow and got a flickering, color-shifted mess, you'll appreciate that the shared-palette detail is already handled here.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| full_pipe | FULL_PIPE | — | |
| filename_prefix | STRING | %time_%seed | Available variables: %date, %time, %model, %width, %height, %seed |
| path | STRING | %date | Available variables: %date, %time, %model, %width, %height, %seed |
| frame_duration | FLOAT | 0.150.01–10 | — |
| scale | FLOAT | 1.000.1–1 | — |
| gif_quality | INT | 1281–256 | — |
| imageopt | IMAGE | — |
Outputs (0)
No outputs