DP Image Empty Latent Switch Flux
One switch for txt2img vs img2img on Flux
- vae
- Image_Input
- Model
- Model_Ip_Adapter
- controlnet_condition
- switch_settings
- MODEL
- LATENT
- img2img_strength
- CONTROLNET
Building a Flux workflow that has to do both text-to-image and image-to-image usually means maintaining two graphs, or rewiring the latent path every time you switch. This node is a mode selector that flips the whole thing with one dropdown: on Txt2Image it emits an empty latent at your chosen size; on Img2Img it encodes your input image into a latent instead. It also carries toggles for the IPAdapter and ControlNet branches so the same graph can turn those paths on and off.
It's a workflow-glue node from DesertPixelAi's Desert Pixel pack, and it's built specifically for Flux. Be honest with yourself about what it is: it's the connective tissue of the author's Flux template, powerful when you're inside that layout and genuinely confusing dropped cold into an unfamiliar graph.
How it works
The core control is Mode_Settings (Txt2Image / Img2Img). In txt2img it builds an empty latent from width/height; in img2img it takes the optional Image_Input (plus a vae to encode it) and passes img2img_strength through as the denoise amount for your sampler. IPadapter_Mode and ControlNet_mode are on/off switches for those two conditioning paths, routing the relevant optional inputs (Model_Ip_Adapter, controlnet_condition) through when enabled.
The outputs reflect that routing: MODEL (the model to sample with, chosen between your base and the IPAdapter-patched one), LATENT (empty or encoded, per the mode), img2img_strength (FLOAT, to wire into your sampler's denoise), and CONTROLNET (the ControlNet condition, passed through when that mode is on). Everything is designed so one sampler downstream just works regardless of which mode you picked.
The inputs and outputs that matter
Mode_Settings is the whole point - that's the switch. Then width/height for txt2img, or Image_Input + img2img_strength for img2img. Flip IPadapter_Mode / ControlNet_mode only if your graph actually has those branches wired to the optional inputs. Route LATENT and MODEL into your sampler, and img2img_strength into its denoise.
How to install it
ComfyUI Manager: search Desert Pixel, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes
Restart ComfyUI. No downloads for the node - you supply your own Flux model, VAE, and any ControlNet/IPAdapter models. Under the DP category.
Common issues & troubleshooting
Img2Img mode produces an empty/black result. In img2img the node needs both Image_Input and a vae to encode it. Miss the VAE and there's nothing to build the latent from. Also check img2img_strength: too low and the output barely changes from the input; near 1.0 and it ignores the input almost entirely.
ControlNet/IPAdapter toggles seem to do nothing. The switches only route inputs that are actually connected. ControlNet_mode: Controlnet_ON with nothing in controlnet_condition has nothing to pass. Wire the optional inputs before flipping the toggles.
It's confusing in my own graph. This node assumes the surrounding Flux template it was designed for. If you're not using that layout, a plain EmptyLatentImage + a separate VAEEncode with a manual switch may be clearer than bending this node to fit. It shines inside its intended workflow, less so as a drop-in.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| Mode_Settings | COMBO | Txt2Image | 2 options: Txt2Image, Img2Img |
| IPadapter_Mode | COMBO | IPadapter_OFF | 2 options: IPadapter_OFF, IPadapter_ON |
| ControlNet_mode | COMBO | Controlnet_OFF | 2 options: Controlnet_OFF, Controlnet_ON |
| img2img_strength | FLOAT | 0.000–1 | — |
| width | INT | 102464–8192 | — |
| height | INT | 102464–8192 | — |
| vaeopt | VAE | — | |
| Image_Inputopt | IMAGE | — | |
| Modelopt | MODEL | — | |
| Model_Ip_Adapteropt | MODEL | — | |
| controlnet_conditionopt | ControlNetCondition | — | |
| switch_settingsopt | SWITCH_SETTINGS | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| LATENT | LATENT | — |
| img2img_strength | FLOAT | — |
| CONTROLNET | ControlNetCondition | — |