πΎ Seed Lock
Lock a seed the way you actually think β not the way ComfyUI defaults
- seed
Seeds are the most fiddly thing in ComfyUI. You set one, it changes, you can't remember what gave you that one good image. The stock behavior feels backwards: a seed widget shows you the previous run's value, so the seed you're "locking" is the one you already used. πΎ Seed Lock exists to fix that exact confusion - it's a two-value node with a toggle: when locked, it outputs the seed you chose to lock; when unlocked, it passes the live value through. The name is a lie in the best way: it doesn't lock anything globally, it just makes "use this exact seed" explicit and obvious.
How it works
Three required inputs, all INT:
- seed - the live value coming through (wire it from a RandomSeed or another source, or type one).
- locked_seed - the value you want to keep. This is the "freeze me a good result" field.
- lock (BOOLEAN, default off) - the switch.
The mechanism is a two-line ternary in the source: if lock is true, output locked_seed; otherwise output seed. That's it. Output is a single INT, seed, which you wire into a KSampler's seed input (or anywhere else that takes a seed).
Why this beats the stock widget
The stock KSampler seed widget randomizes on each queue run and shows the value after the fact. With Seed Lock you get the mental model you actually want: "I like this image β note the seed β set locked_seed β flip lock on β every run from now uses it." When you're done, flip lock off and the live random behavior comes back, no resetting, no reloading. It's the difference between chasing a seed and choosing one. It also plays nicely in batch-diversity rigs: keep seed wired to a random source so unlocked runs vary, then freeze the winner on demand.
Installing it
Ships in the MachinePainting Nodes pack. ComfyUI Manager β search "MachinePaintingNodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/machinepainting/ComfyUI-MachinePaintingNodes.git
Restart ComfyUI. The pack's dependencies (opencv-python-headless, numpy<3, rembg) are irrelevant here - this node passes integers.
Gotchas
locked_seeddefaults to 0. If you fliplockon without setting it, you'll suddenly be generating seed-0 images forever. Set the value first; the toggle is the last step, not the first.- The lock is per-node, not global. Each Seed Lock freezes its own value; a workflow with three samplers needs three of these (or one per sampler you actually want frozen).
- It doesn't remember your last good seed for you. You still have to read the value off a previous run and type it in - the node just makes holding it stable afterward.
There are fancier seed managers in the ecosystem (rgthree's Seed node remembers what it just ran), but if you want the dead-simple "lock this number" behavior without the extras, this is the cleanest version of that idea. Set the seed, flip the switch, stop chasing ghosts.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00β18446744073709550000 | β |
| locked_seed | INT | 00β18446744073709550000 | β |
| lock | BOOLEAN | false | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| seed | INT | β |