Nodes/comfyui-easy-randomize/Save Image (with Selections)
ComfyUI Node

Save Image (with Selections)

Save your image with the recipe baked in

By Ckrest·Created 8 months ago·Updated 4 months ago· 0
Save Image (with Selections)
  • images
  • images
filename_prefixComfyUI
selection_json

Save Image (with Selections) is a drop-in replacement for the stock Save Image node that does one extra thing: it takes a JSON string of your random selections and embeds it in the image's metadata, right alongside the workflow JSON that ComfyUI always stamps in. In the ecosystem's culture of "workflow included," this is the pack's way of also including which random rolls produced the image - the recipe, not just the shopping list.

How it works

The node subclasses ComfyUI's own SaveImage, so everything about the save behaves normally - images in, file written to your output directory with the filename_prefix naming it. The difference is the optional selection_json input. If it's connected, the node tucks that string into the PNG's extra_pnginfo under a selections key before calling the parent save. It then passes the images through unchanged on the images output, so you can chain more nodes after it if you like.

Where does the JSON come from? The pack's Selection Recorder node. Wire each random selector's output into the recorder, take its json_output, and feed it here. The result: every saved PNG carries a machine-readable note of exactly which items were selected, and because it's part of the standard ComfyUI PNG metadata, it travels with the file - share it, re-import it, and the record comes along.

The inputs that matter

  • images - the IMAGE tensor to save.
  • filename_prefix - the filename prefix, ComfyUI by default. Set something descriptive per branch.
  • selection_json (optional) - the JSON string from Selection Recorder. Skip it and this is just a normal Save Image.

Gotchas

The metadata is only as useful as the JSON you feed it, and the pack's recorder is minimal - it timestamps and wraps whatever two strings you hand it. Don't expect a rich structured log. Also, the selection record lives in extra_pnginfo, so it's visible to PNG metadata readers but isn't rendered on the image itself; if you want the prompt visible at a glance, pair this with Preview Image + Text instead.

How to install

Same pack, same no-fuss install - no dependencies beyond ComfyUI, no models:

cd ComfyUI/custom_nodes
git clone https://github.com/Ckrest/comfyui-easy-randomize.git

Restart ComfyUI, or install "comfyui-easy-randomize" via ComfyUI Manager. It registers under Local Custom/Output.

Where it fits

If you're doing serious randomize-and-freeze iteration, this is the node that makes the results auditable. Weeks later, when you're staring at a folder of images and can't remember why one is good, the metadata answers it - and with the workflow JSON also embedded, you can drag the image back into ComfyUI and reconstruct the exact pipeline. That's the reproducibility the whole pack is quietly selling, and this node is where it lands on disk.

CategoryLocal Custom/Output

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
filename_prefixSTRINGComfyUI
selection_jsonoptSTRING

Outputs (1)

NameTypeDescription
imagesIMAGE