保存生命游戏动画
Turn LifeGameAnimation's frames into an actual GIF, preview included
- images
- preview_path
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.gifin ComfyUI's output directory, with thedurationderived from yourfps. It also copies the file into the pack'sweb/tempfolder 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.pngand friends), plus ametadata.jsondescribing 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
IMAGEbatch from LifeGameAnimation (or anything else that outputs a frame sequence). - format -
png,jpg,webp, orgif. 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.jsonfor 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, orwebpand you get a folder of frames and apreview_paththat 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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| format | COMBO | gif | 4 options: png, jpg, webp, gif |
| fps | INT | 101–60 | — |
| filename_prefix | STRING | lifegame_animation | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| preview_path | STRING | — |