Nodes/ComfyUI Smart Helper Nodes/Smart Save Animated GIF
ComfyUI Node

Smart Save Animated GIF

Turn a batch of frames into an animated GIF, alpha channel included

By slvslvslv·Created 2 years ago·Updated 7 days ago· 3
Smart Save Animated GIF
  • images
  • file_path
filenameanimation.gif
fps10.0
loop0
optimizetrue
quality95
preserve_transparencytrue
alpha_threshold0.01

If you render video frames in ComfyUI and your go-to move is "save the PNGs and stitch them with ffmpeg," Smart Save Animated GIF is the shortcut that saves you the stitching step. It takes your image batch and writes a single animated GIF straight to ComfyUI's output folder. Handy for quick previews, Discord-ready clips, and anything that needs to play anywhere without a video codec.

The node is a thin wrapper around Pillow's animated-GIF saving, but it handles the fiddly parts people actually trip on. First, the boring but nice stuff: fps (0.1–60, default 10), loop (0 = infinite, the default), and optimize (default on). quality (1–100, default 95) maps to PIL's quality setting - for GIFs the real file-size driver is the 256-color palette quantization rather than that number, so treat it as a coarse dial, not a precision tool.

The interesting part is transparency. GIF transparency is binary - a pixel is either fully transparent or not, there's no alpha blending - and the node implements it with a key-color trick. With preserve_transparency on, it looks at each frame's alpha channel against alpha_threshold (default 0.01), finds a random RGB color that no opaque pixel in any frame uses, replaces all the sub-threshold transparent pixels with that key color, builds a global 256-color palette across all frames, and marks the key color as the transparent index. It's a classic GIF workaround, and it means you can save RGBA output - layered renders, cutouts, sprites - without a white or black background baked in. Turn preserve_transparency off (or feed it opaque RGB frames) and it composites onto white instead, which is what you want for ordinary video previews.

Practical gotchas from how it's built. The filename is auto-suffixed with .gif if you forget, and it can include subdirectories, which it creates for you - so previews/clip3.gif just works relative to the output folder. It returns file_path as a string, so you can chain it into anything that wants to know where the file landed. And GIF is a format with hard limits: 256 colors per global palette and no temporal compression, so longer or high-detail clips get big fast - this is a preview node, not your final video export. Keep clips short and you'll be fine.

The input is a standard IMAGE batch - exactly what a VAE decode of a video produces - so the wiring is decode → this node, nothing in between. If you're using it for a WAN clip, batch order is frame order, no surprises.

Install via ComfyUI Manager (search "Smart Helper Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/slvslvslv/ComfyUI-SmartHelperNodes

Then restart ComfyUI. The pack has no pip dependencies beyond Pillow, which ComfyUI already requires, so nothing extra to install and no model downloads.

CategorySmartHelperNodes

Inputs (8)

NameTypeDefaultDescription
imagesIMAGESeries of images to save as animated GIF
filenameSTRINGanimation.gifOutput filename for the GIF
fpsFLOAT10.00.1–60Frames per second for the animation
loopINT00–65535Number of loops (0 = infinite loop)
optimizeBOOLEANtrueOptimize the GIF file size
qualityINT951–100Quality of the GIF (higher = better quality, larger file)
preserve_transparencyBOOLEANtruePreserve alpha channel as GIF transparency (binary)
alpha_thresholdFLOAT0.010–1Alpha values below this are transparent (0 = only fully transparent, 1 = all transparent)

Outputs (1)

NameTypeDescription
file_pathSTRING