Modular ComfyUI: One Graph for txt2img, img2img, Upscale
Build a single ComfyUI graph for txt2img, img2img, and upscale using bypass, KSampler denoise, and reusable templates.
On this page
Modular ComfyUI Workflows: One Graph for txt2img, img2img, Upscale
TL;DR
- Toggle any stage with
Ctrl + B. Bypassed nodes stay on the canvas but are removed from execution. - One graph, three modes:
EmptyLatentImagefor txt2img,VAEEncode+denoise < 1.0for img2img,UpscaleModelLoader → ImageUpscalefor upscaling. - Group for clarity, not reuse:
Ctrl + Gcollapses visually. For true reuse, use.jsontemplates or a custom node.
Why Modular Workflows Matter
ComfyUI workflows are directed acyclic graphs. Every task — load model, encode prompt, sample, decode, upscale — is a discrete node with typed inputs and outputs. Because the graph is data-flow rather than imperative code, you can rewire, bypass, or duplicate branches without rewriting logic. A modular workflow keeps optional stages (ControlNet, IPAdapter, upscaler) in separate bypassable branches so the same .json serves text-to-image, image-to-image, and high-res fix without duplication.
The Toggle Mechanism: Bypass, Don't Delete
How bypass works
Select any node and press Ctrl + B. ComfyUI removes it from the execution graph and stitches inputs directly to outputs. The node stays on the canvas (dimmed) so you can re-enable it instantly with another Ctrl + B.
Source: ComfyUI README: "Ctrl+B— Bypass selected nodes (acts like the node was removed from the graph and the wires reconnected through)" [^1]
A right-click "Bypass Node" may exist in recent UI builds, but the documented mechanism is Ctrl + B.
When to bypass vs. delete
| Scenario | Action |
|---|---|
| Temporary disable | Ctrl + B |
| Permanent removal | Delete and rewire manually |
| Swap model | Keep node, change loader input |
One Graph, Three Modes
The pivot is KSampler. Its latent_image input and denoise parameter determine the generation mode.
txt2img (pure generation)
EmptyLatentImage → KSampler (denoise = 1.0) → VAEDecode
EmptyLatentImage creates pure noise at your target resolution. denoise = 1.0 means the sampler ignores input latent structure entirely.
img2img (guided transformation)
LoadImage → VAEEncode → KSampler (denoise < 1.0) → VAEDecode
VAEEncode compresses the input image to latent space. The KSampler docs say "lower values will maintain the structure of the initial image allowing for image to image sampling" [^2]. denoise < 1.0 preserves that structure; lower values stay closer to the source, higher values allow more creative deviation.
upscale (high-res fix)
KSampler → VAEDecode → UpscaleModelLoader → ImageUpscale → (optional) VAEDecode again
UpscaleModelLoader reads a model file from models/upscale_models/ (for example 4x-UltraSharp.pth). For a true high-res fix, insert a second KSampler after ImageScale → VAEEncode, matching the two-pass pattern linked in ComfyUI's examples [^1].
Optional Conditioning Branches
ControlNet (built-in)
ControlNetApply and ControlNetApplyAdvanced are built-in nodes. They take:
- positive / negative conditioning
control_netmodel (loaded viaControlNetLoader)- preprocessed image: Canny, OpenPose, Depth, etc.
strength(0–10, recommended 0.5–1.5)
Output is modified conditioning. To disable: bypass ControlNetApply.
Source: ControlNetApply docs: "Controls the strength of network adjustments, value range 0~10. Recommended values between 0.5~1.5 are reasonable." [^3]
IPAdapter (third-party)
IPAdapter is not a built-in node. It comes from community custom node packs (for example comfyui-ipadapter). The typical chain:
LoadImage → IPAdapterEncoder → IPAdapterApply → conditioning
To disable: bypass IPAdapterApply. IPAdapter has no built-in on/off switch separate from bypass.
Grouping: Visual Only, Not Reusable
Ctrl + G creates a collapsible visual group. It helps readability but does not create a callable sub-graph, allow drag-and-drop reuse, or export a standalone component.
For true reuse:
| Approach | How it works | Trade-off |
|---|---|---|
| Workflow templates | Save a .json with only the sub-graph; import via Workflows → Open | Manual wiring each time |
| Custom node (Python) | Write a node that internally builds the sub-graph | Requires Python, cleanest API |
| Copy-paste + regroup | Ctrl + C / Ctrl + V across tabs | Fastest for ad-hoc reuse |
Source: ComfyUI README: "Ctrl+G— Group selected nodes" — grouping is a UI shortcut, not a module system [^1].
Settings Reference Table
| Parameter | txt2img | img2img | Upscale (HR fix) | Source |
|---|---|---|---|---|
KSampler latent_image | EmptyLatentImage | VAEEncode(LoadImage) | First pass: EmptyLatentImage; second pass: VAEEncode(ImageScale) | [^2] |
KSampler denoise | 1.0 | any value below 1.0 | First pass: 1.0; second pass: below 1.0 | [^2] |
ControlNet strength | 0.5–1.5 if used | 0.5–1.5 | Usually off for upscale pass | [^3] |
| Upscale model | — | — | example 4x-UltraSharp.pth in models/upscale_models/ | [^4] |
| Checkpoint loader | CheckpointLoaderSimple | CheckpointLoaderSimple | shared across all passes | [^5] |
Common Errors and Fixes
| Symptom | Cause | Fix |
|---|---|---|
| "Load > Load (custom nodes)" not found | Custom-node installation is not workflow loading | Use Workflows → Open (Ctrl+O) or drag .json onto the canvas [^6] |
| IPAdapter node missing | IPAdapter is not built-in | Install a custom node pack via ComfyUI Manager |
| ControlNet does nothing | Preprocessor missing or wrong image format | Install comfyui-controlnet-preprocessors; match preprocessor to input type |
| UpscaleModelLoader shows no models | Model file not in models/upscale_models/ | Place .pth/.onnx there, then refresh or restart [^4] |
| img2img ignores input image | denoise left at 1.0 | Set denoise below 1.0 [^2] |
| Bypassed node still runs | Node not actually bypassed | Re-select node, press Ctrl + B, verify dimming/wire pass-through |
FAQ
How do I toggle a workflow stage on and off? Select the node and press Ctrl + B. Press again to re-enable.
Can one ComfyUI graph handle txt2img, img2img, AND upscale? Yes. Feed KSampler an EmptyLatentImage for txt2img, a VAEEncode latent with denoise < 1.0 for img2img, and chain UpscaleModelLoader → ImageUpscale after decode for upscaling. All modes share the same checkpoint, CLIP, and VAE.
Is "ComfyUI Modular Node System" an official feature name? No. ComfyUI's tagline is "the most powerful and modular diffusion model GUI," referring to its node-graph architecture. There is no product or API called "Modular Node System."
How do I load a workflow JSON into ComfyUI? Drag the .json onto the canvas, or use Workflows → Open (Ctrl+O). The "Load (custom nodes)" menu installs Python custom-node packages, not workflows.
Does ComfyUI have a right-click "Bypass Node"? The documented bypass is Ctrl + B. A right-click option may exist in recent UI builds but is not in the official shortcuts table.
Are IPAdapter and ControlNet nodes built into ComfyUI? ControlNetApply and ControlNetApplyAdvanced are built-in. IPAdapter is a third-party custom node.
What does the KSampler denoise parameter actually do? At 1.0 (default), the sampler treats the input latent as pure noise. Below 1.0, it blends the input latent's structure with the denoised output — lower values preserve more of the original image.
How do I make a truly reusable node group? Save a sub-graph as a .json template and import manually, write a custom Python node, or copy-paste nodes across workflow tabs.
Sources
[^1]: ComfyUI GitHub README — shortcuts and architecture — https://github.com/Comfy-Org/ComfyUI [^2]: KSampler built-in node documentation — https://docs.comfy.org/built-in-nodes/KSampler.md [^3]: ControlNetApply built-in node documentation — https://docs.comfy.org/built-in-nodes/ControlNetApply.md [^4]: UpscaleModelLoader built-in node documentation — https://docs.comfy.org/built-in-nodes/UpscaleModelLoader.md [^5]: CheckpointLoaderSimple built-in node documentation — https://docs.comfy.org/built-in-nodes/CheckpointLoaderSimple.md [^6]: ComfyUI text-to-image tutorial (workflow loading) — https://docs.comfy.org/tutorials/basic/text-to-image
Internal Links
- ComfyUI custom node development
- ControlNet preprocesses ComfyUI high-res fix patterns
- VAE encoding and latent space basics