Switch Integer
A boolean switch for any integer in your workflow
- ui_widget
- int
- int_list
Some nodes are the stars of the show, and some are the little toggle you stop noticing after a week. SwitchInteger is firmly in the second camp - and that's the nicest thing you can say about it. It picks between two integer values based on a boolean, and it does that one job without any of the cleverness that could break.
You'll reach for it whenever a single checkbox should flip a number somewhere else in the graph. The classic use is batch size: wire one value for "testing, keep it cheap" and one for "real render, burn the VRAM," then flip a boolean instead of hunting through the graph for the right widget. Same for CFG steps, latent tile counts, or the number of images in a batch. It's also the standard building block for the "A/B settings" pattern the ecosystem loves - build two config branches and switch between them from one control point.
Mechanically it's a plain ternary: on_true and on_false are both INTs (default 0, up to the full 64-bit range), boolean decides which one comes out. No lazy evaluation like the LF image switch - integers are free to compute, so there's nothing to skip. The outputs are int (single value) and int_list (the same value as a list type), so it plugs into both a KSampler's steps and any batch-aware node.
The inputs that matter:
boolean- the switch; a checkbox or a wire from any boolean source.on_true/on_false- the two candidate integers.
Honestly, if your integers are just two fixed numbers, this is more convenient than a MathOperation-style combo because the boolean widget itself is the UI - flip it, done. If you want more than two options, an LF-style selector or a ResolutionSwitcher is the better tool; this node is deliberately, boringly binary.
Installing LF Nodes (same pack for every LF node):
- ComfyUI Manager → search "LF Nodes" → install → restart, or
cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/comfyui-lfthen restart.
One thing worth knowing: this repo is frozen in legacy mode - it migrated to lucafoscili/lf-nodes and won't get new features here, but everything still runs and this node carries over unchanged. It pulls no model files; the pack's only real dependencies are numpy, Pillow and opencv-python (the openai and piexif in its requirements are for the LLM and metadata nodes you're probably not using).
The one gotcha is the output you grab. int is the plain value; int_list is the list-typed variant. If a node downstream won't accept your wire, try the other output rather than assuming the node is broken - that mismatch is the #1 "why won't it connect" complaint with this pack's switches.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| on_true | INT | 0 | Value to return if the boolean condition is true. |
| on_false | INT | 0 | Value to return if the boolean condition is false. |
| boolean | BOOLEAN | false | Boolean condition to switch between 'on_true' and 'on_false' values. |
| ui_widgetopt | KUL_PROGRESSBAR | [object Object] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| int_list | INT | — |