Nodes/ComfyUI-LifeGame/保存生命游戏动画
ComfyUI Node

保存生命游戏动画

Turn LifeGameAnimation's frames into an actual GIF, preview included

By assemly·Created about a year ago·Updated about a year ago· 2
保存生命游戏动画
  • images
  • preview_path
formatgif
fps10
filename_prefixlifegame_animation

This is the second half of the comfyui-lifegame pair. LifeGameAnimation generates a batch of Game of Life frames; LifeGameSaveAnimation takes that IMAGE batch and writes it to disk as a GIF, or as a folder of PNG/JPG/WebP frames. It's the output node for a mini procedural-animation pipeline that never touches a diffusion model.

And it has one trick most save nodes don't: the GIF renders an in-node preview over the WebSocket as soon as it's written. No waiting for the whole queue, no hunting through output/ to see what you got. The preview appears on the node itself, and a right-click menu adds "open in new tab", "copy filename", and "show in system explorer" - genuinely handy if you're iterating on presets and want to eyeball each result fast.

How it works

The node is marked as an output node, so it's the end of the line in your graph. It takes the image batch, walks each frame, converts it through PIL, and writes one of two things depending on format:

  • gif - a single looping animated GIF (loop forever) saved as lifegame_animation_00000.gif in ComfyUI's output directory, with the duration derived from your fps. It also copies the file into the pack's web/temp folder and pokes the frontend over WebSocket so the preview pops up on the node.
  • png / jpg / webp - a folder named after the file, one frame per file (frame_00000.png and friends), plus a metadata.json describing frame count, fps, format, and dimensions.

It's a deliberately simple output node: no metadata wrangling, no PNG chunks with the workflow baked in like core SaveImage does. That's fine for animated GIFs - GIF has nowhere to hold that data anyway.

The inputs, all four of them

  • images - the IMAGE batch from LifeGameAnimation (or anything else that outputs a frame sequence).
  • format - png, jpg, webp, or gif. Default is gif, and honestly it's the one you want: it's the only format that gets the live in-node preview.
  • fps - 1 to 60, default 10. Sets both the GIF's playback speed and the metadata.json for frame sequences.
  • filename_prefix - default lifegame_animation. The saved file is this prefix plus a zero-padded counter.

The single STRING output is preview_path, which for a GIF run is the relative path of the generated file.

Installing it

Same story as its sibling - it ships in assemly/comfyui-lifegame, a tiny pack with no model downloads. Via ComfyUI Manager, search "comfyui-lifegame"; or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/assemly/comfyui-lifegame
pip install -r requirements.txt

Restart ComfyUI and you'll find it under the 生命游戏 (Game of Life) category, alongside LifeGameAnimation. Dependencies are numpy, Pillow, and aiohttp - all but certainly already present in your environment.

Gotchas

  • Preview is GIF-only. Pick png, jpg, or webp and you get a folder of frames and a preview_path that comes back empty - no in-node preview. If you want to see what you're making, save as GIF; if you need stills for something else, accept you'll check the output folder yourself.
  • Filename counter is a count, not a guarantee. The node numbers files by counting everything in your output directory, so deleting or renaming files can cause it to pick a number that already exists and overwrite. Rename or move outputs you care about.
  • It only saves; it doesn't resize. The frame dimensions are whatever LifeGameAnimation rendered. Feed it a 500×500 grid at cell_size 5 and you get 500×500 GIFs - nothing here will upscale for you.

Keep this node as the endpoint of a LifeGameAnimation → LifeGameSaveAnimation chain and you've got a zero-fuss, fully offline looping animation generator. It's a novelty, sure - but it's a smooth one.

Category生命游戏

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
formatCOMBOgif4 options: png, jpg, webp, gif
fpsINT101–60
filename_prefixSTRINGlifegame_animation

Outputs (1)

NameTypeDescription
preview_pathSTRING