Seed Generator (Citron Image Saver)
A seed on a wire, plus an offset that's more useful than it looks
- INT
ComfyUI bakes the seed into the KSampler widget, which is fine until the same seed has to reach three other places: the save node's seed_value, the filename template's %seed, and a second sampler further down the graph. Then you're either converting widgets to inputs or typing the same 15-digit number more than once, and the second option is how you end up with a filename that doesn't match the image.
Seed Generator is the one-source-many-consumers fix: a seed box with the standard randomise control, an offset field, and a single INT output.
How it works
Two required inputs. seed is a 0-to-64-bit integer with control_after_generate attached, so you get fixed / increment / decrement / randomize like any core seed widget. increment is an offset - the tooltip is "number to add to the final seed value" - and it accepts negatives, which is where this node gets more interesting than it looks.
The output is INT, and the value is simply seed + increment. That's the whole implementation, and it stays honest about it: no hidden randomisation, no clamping surprises on the way out.
The increment is the part worth understanding. It means you can hold a base seed constant and derive variant seeds from it with an arithmetic box - seed stays at 123456789, increment goes 0, 1, 2, 3 across four runs, and you get four related-but-distinct results that you can reconstruct later. It also means you can subtract: a negative increment rewinds a seed without retyping it. Compare that to control_after_generate: increment, which mutates the seed box itself between runs and, in the "after" timing mode, leaves the widget showing a number that isn't the one that ran.
That last bit is the trap the whole ComfyUI ecosystem trips over. control_after_generate fires after the queue finishes by default, so with randomize the number in the box after a run is the next one, not the one you just used. ComfyUI's setting "widget control mode" switched from After to Before makes the control act first, so what's displayed is what ran. If you've ever lost a seed and gone hunting through output PNGs for it, that setting is the fix - worth doing once per install, before you need it.
Wire the INT output into a converted seed input on the KSampler, into the saver's seed_value, and trust the filename template's %seed to pick up the same value. Everything agrees, and the file records the seed that produced it rather than a nearby one.
For anything scripted - four variants of the same prompt, a batch where you want determinism - this is the node I'd reach for over three separate seed widgets. It's also the cheapest way to make a workflow reproducible for someone else: one visible seed at the top, everything else derived.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/citronlegacy/ComfyUI-CitronNodes
# restart ComfyUI
ComfyUI Manager search may come up empty - the README lists Manager support as "coming soon" and the repo's package metadata is still placeholder - so clone manually. The pack's only pip dependency is piexif, imported by the saver module; if it's missing, the pack fails to load entirely:
pip install piexif
No models to fetch. Category: Citron_ImageSaver/utils.
Common issues
- The seed box changed but the image didn't, or vice versa. Check
control_after_generateand the global widget control mode. Most "random seed doesn't work" reports are this. - Seed doesn't match the output. Something else is feeding the sampler's seed - often a second seed widget that was never converted to an input.
- I need a seed above 1000000. Fine here; this ceiling is the full 64-bit range. The pack's Int Literal caps at a million, which is not enough for a seed field.
- Negative values in the increment. Allowed and useful - that's the rewind case, not a bug.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00–18446744073709550000 | The random seed used for creating the noise. |
| increment | INT | 0-18446744073709550000–18446744073709550000 | number to add to the final seed value |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | seed (INT) |