Extensions/Nifty Nodes for ComfyUI
ComfyUI Extension

Nifty Nodes for ComfyUI

Utility nodes for ComfyUI: logic switches, bundle nodes, selectors, bypass nodes, image/latent utilities, and workflow automation nodes.

By Stibo·Created 5 months ago·Updated 2 months ago· 8
Stibo/comfyui-nifty-nodes
Nodes70
On cloudLocal install
Categorynifty/string, nifty/logic
Stars8
Updated2 months ago

Nodes (70)

Any To String

Turn numbers, booleans and seed widgets into one clean string

nifty/string
Boolean AND

The tiny gate that keeps your workflow from sampling when it shouldn't

nifty/logic
Boolean AND All

One gate for 'every single condition passed'

nifty/logic
Boolean NOT

The one-node inverter that turns 'if' into 'unless'

nifty/logic
Boolean OR

The 'run it if anything qualifies' gate

nifty/logic
Boolean OR Any

One socket list for 'at least one of these is true'

nifty/logic
Boolean XOR

The 'exactly one of these, not both' gate

nifty/logic
Bundle Get

Pull one named value out of a bundle, dot-notation and all

nifty/bundle
Bundle Pack

Stuff up to 32 named values into one wire and declutter your graph

nifty/bundle
Bundle Set

Write one key into a bundle without touching the rest

nifty/bundle
Bundle Unpack

Explode a bundle back into individual outputs

nifty/bundle
Bypass By Title

Flip whole sections off by name instead of hunting for the toggle

nifty/utils
Bypass Switch By Title

A dropdown that swaps between workflow configurations

nifty/utils
CLIP Selector

Pick your text encoder without digging through loader dropdowns

nifty/selectors
Nifty CLIP Text Encode (Prompt)

Positive and negative prompts in one node, no extra wire clutter

nifty/conditioning
CLIP Type Selector

A dropdown for the one text-encoder setting everyone forgets

nifty/selectors
Combo Switch

Pick between two dropdown values based on a boolean

nifty/logic
Debug Any

See what's actually traveling down any wire

nifty/utils
Diffusion Model Selector

Swap UNets and GGUF models from one dropdown

nifty/selectors
Nifty Dynamic Prompt

Wildcards and random prompt variation with a real seed

nifty/string
Embed Media Meta Bundle

Bake a settings manifest into your saved PNGs

nifty/media
First Switch

The 'give me the first thing that actually exists' node

nifty/logic
Float Switch

The float if/else you'll wire everywhere

nifty/logic
Hidden Link

A pass-through node that only exists to make your graph less ugly

nifty/utils
Image Color Match

Steal another image's color grading with ten different algorithms

nifty/image
Image From Batch

Pull frame 12, or the last 4, out of a batch of images

nifty/image
Index Combo Switch

The switch you don't have to count to

nifty/logic
Index Combo Switch (Eager)

The eager combo router

nifty/logic
Index Input Switch

The data-driven router

nifty/logic
Index Input Switch (Eager)

The index router that evaluates all 16 branches (use sparingly)

nifty/logic
Index Output Switch

Routing the other direction

nifty/logic
Input Switch

The if/else ComfyUI actually needed — and the lazy part is the whole point

nifty/logic
Input Switch (Eager)

The Input Switch that runs both branches

nifty/logic
Int Switch

The 2-in-1 integer switch

nifty/logic
Is None

Is it even there?

nifty/logic
Last Image From Batch

Grab the last N frames, no math required

nifty/image
Last Latent From Batch

The last N latents, 4D or 5D, without the index math

nifty/latent
Latent From Batch

Slice latents like frames — and it knows video latents are 5D

nifty/latent
Load & Resize Image

A loader that resizes on the way in — and reads PNG metadata as a bundle

nifty/media
Load & Resize Media

The one loader for images AND video, with resize, audio, and an is_video flag

nifty/media
Load & Resize Video

Load a video and make it the right size in one node

nifty/media
Nifty Lora Loader

Stack your LoRAs in one node instead of a chain of loaders

nifty/lora
Nifty Lora Stack

Define your LoRA stack once, apply it anywhere

nifty/lora
Nifty Apply Lora Stack

Apply a saved LoRA stack to any model, anywhere in the graph

nifty/lora
Nifty Math

Replace a tower of math nodes with one expression

nifty/number
Merge Image Batches

Stitch two video clips together with an actual crossfade

nifty/image
Node Chain Extender

Duplicate a node N times and wire the copies together automatically

nifty/utils
None Input Switch

Pick a fallback when an optional input is actually None

nifty/logic
None Input Switch (Eager)

The None switch that runs both branches no matter what

nifty/logic
None Output Switch

Route a stream into exists-or-none, and block the branch you don't want

nifty/logic
None

The node that outputs nothing, on purpose

nifty/logic
Normalize Video Latent Start

Fix the weird first frames of a generated video before you sample

nifty/latent
Number Compare

Compare numbers, get a boolean

nifty/logic
Output Switch

Send a value down one path and genuinely block the other

nifty/logic
Preview Any

See what's flowing through any wire without a preview image

nifty/utils
Nifty Random Noise

Hand a sampler its noise, instead of letting it make its own

nifty/sampling
Resize Image

The pack's full resize engine, on any image or mask

nifty/image
Sampler Selector

One dropdown for every sampler, wired as a string

nifty/selectors
Scheduler Selector

Pick one scheduler for every sampler in your graph

nifty/selectors
Nifty Seed

A seed node with a dice button and a random-on-queue toggle

nifty/number
Signal Switch

The on/off gate that genuinely skips work

nifty/logic
Simple Title

The sticky note that never wanders off

nifty/utils
String Compare

Turn any text check into a yes/no your graph can act on

nifty/logic
String Join

One small node that fixes the 'prompt is a list' problem

nifty/string
String Split

Slice a prompt or filename into a list you can actually use

nifty/string
String Switch

Pick between two text values with one boolean

nifty/logic
Subgraph Labels

Name the ports of a subgraph so the wiring makes sense

nifty/utils
VAE Encode

Encode only the frames you actually need

nifty/latent
Wan Video NAG

Keep your negative prompt, skip the CFG tax

nifty/model
Nifty Wan Video SLG

STG guidance for CFG=1, flicker be damned

nifty/model
Readme

ComfyUI Nifty Nodes

A ComfyUI node pack focused on workflow organisation and flexibility. The centrepiece is a Bundle system for passing arbitrary named values through a single wire, alongside smart media loaders with built-in resize, a multi-LoRA loader, a full set of logic and switch nodes, image processing tools, latent utilities, and various quality-of-life helpers.

Installation

Clone the repository into your ComfyUI custom_nodes folder:

cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes

Then restart ComfyUI. Optional dependencies for certain nodes:

pip install kornia        # reinhard_lab_gpu and perceptual_crossfade in Image Color Match
pip install color-matcher # additional color transfer methods in Image Color Match

Features

  • ComfyUI v3 native — built entirely on the comfy_api.latest API with proper define_schema, lazy evaluation, fingerprint_inputs caching and async execution where applicable
  • Bundle system — pass any number of named values through a single BUNDLE wire, with dot-notation support for nested structures
  • Smart media loaders — load images, videos or both with an integrated resize pipeline, optional frame rate control and embedded meta bundle extraction; use Embed Media Meta Bundle to inject metadata into saved PNGs
  • Multi-LoRA loader — manage an entire LoRA stack in one node with per-row enable/disable and strength controls; or build reusable stacks with Lora Stack and Apply nodes
  • Full logic suite — lazy and eager input switches, output routers, indexed combo switches, boolean operators, string/number comparisons and more
  • Image Color Match — 10 color transfer methods including GPU-accelerated options, batch multithreading and selective channel transfer
  • Model guidance — WAN-native NAG (Normalized Attention Guidance) and SLG/STG nodes for WAN 2.1 / 2.2 video models
  • CLIP Text Encode — combined positive/negative prompt encoding in a single node
  • Dynamic Prompt — wildcard-based prompt generation with deterministic seeds, powered by the dynamicprompts library
  • Search aliases on every node for fast discovery via the node search

Nodes

Bundle

The Bundle system lets you pack multiple values of any type into a single BUNDLE wire and unpack or access them wherever needed. This keeps graphs clean when many values need to travel together.

Bundle Pack

Packs up to 32 values of any type into a Bundle. An optional incoming Bundle can be merged — new values are added to it or overwrite existing keys.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | bundle | BUNDLE | No | — | Existing bundle to merge into. New slot values overwrite keys with the same name. | | value1 … value32 | ANY | No | — | Values to pack. Controlled by count. | | count | INT | No | 1 | Number of value slots to show (1–32). | | hide_links | BOOL | No | False | Hide the connection wires going into this node to reduce visual clutter. |

Outputs

| Name | Type | Description | |---|---|---| | bundle | BUNDLE | The resulting bundle containing all packed values. |

Bundle Unpack

Unpacks a Bundle back into up to 32 individual outputs. Output labels are set by renaming the slots, matching the keys used when packing.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | bundle | BUNDLE | Yes | — | The bundle to unpack. | | count | INT | No | 1 | Number of output slots to show (1–32). | | hide_links | BOOL | No | False | Hide the connection wires going out of this node to reduce visual clutter. |

Outputs

| Name | Type | Description | |---|---|---| | bundle | BUNDLE | The original bundle, passed through unchanged. | | value1 … value32 | ANY | Unpacked values. Slots beyond count output None. |

Bundle Get

Reads a single value from a Bundle by key.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | bundle | BUNDLE | Yes | — | The bundle to read from. | | key | STRING | Yes | value1 | Key to read. Supports dot notation for nested keys, e.g. settings.width. |

Outputs

| Name | Type | Description | |---|---|---| | value | ANY | The value at the given key, or None if the key does not exist. |

Bundle Set

Writes or overwrites a single key in a Bundle.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | bundle | BUNDLE | Yes | — | The bundle to update. | | key | STRING | Yes | value1 | Key to write. Supports dot notation for nested keys, e.g. settings.width. | | value | ANY | Yes | — | Value to store at the given key. |

Outputs

| Name | Type | Description | |---|---|---| | bundle | BUNDLE | Updated bundle. The original is not modified — a new copy is returned. |

Slot Labels and Key Names

When you rename a slot in Bundle Pack or Bundle Unpack (double-click the slot label), the new name becomes the key used inside the bundle. The same label must be used on both ends for values to align correctly.

Dot Notation and Nesting

Keys use . as a path separator, allowing you to read and write into nested structures. For example:

Bundle Pack  →  slot label: "camera.fov"   →  value: 90
Bundle Get   →  key: "camera.fov"          →  returns: 90

You can nest arbitrarily deep: "render.output.format", "lora.0.strength", etc. Bundle Get and Bundle Set both support full dot-path access.

Merging Bundles

Bundle Pack accepts an optional incoming Bundle. Any values you pack are merged on top of it — existing keys are overwritten, other keys are preserved. This makes it easy to incrementally build up a shared parameter object across multiple nodes.


Media

Load & Resize Media

The most versatile loader — accepts images and videos in a single node, with a built-in resize pipeline. A is_video boolean output lets you route the result differently depending on what was loaded.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | file | COMBO | Yes | none | File to load. Supports image formats (jpg, png, webp, …), animated formats (gif, apng, webp, avif) and video formats (mp4, mkv, webm, …). | | force_frame_rate | INT | No | 0 | Enforce a specific frame rate. 0 = keep original. Values like 24, 30 or 60 resample the video during loading. | | resize | DYNAMIC | No | off | Resize mode to apply after loading — see Resize Modes. |

Outputs

| Name | Type | Description | |---|---|---| | IMAGE | IMAGE | Loaded frames as a batch tensor. None if file is none. | | frames | INT | Total number of frames (1 for still images). | | width | INT | Output width after any resize. | | height | INT | Output height after any resize. | | frame_rate | INT | Frame rate of the source (or the forced rate if set). | | audio | AUDIO | Extracted audio track. Silent if the file has no audio. | | is_video | BOOL | True if the loaded file is a video or animation, False for still images. | | meta_bundle | BUNDLE | Meta bundle embedded in the file's PNG metadata, if any. Empty dict if none found. |

Load & Resize Video

Same as Load & Resize Media but restricted to video and animation file types.

Inputs / Outputs

Same as Load & Resize Media, minus the is_video output.

Load & Resize Image

Same as Load & Resize Media but restricted to image and animation file types. No frames, frame_rate or audio outputs.

Outputs

| Name | Type | Description | |---|---|---| | IMAGE | IMAGE | Loaded image as a tensor. None if file is none. | | width | INT | Output width after any resize. | | height | INT | Output height after any resize. | | meta_bundle | BUNDLE | Meta bundle embedded in the file's PNG metadata, if any. Empty dict if none found. |

Embed Media Meta Bundle

Injects a BUNDLE dict into the workflow's extra_pnginfo so it gets embedded into any PNG saved downstream. Place this node in the wire between a loader and a Save Image node. Passes the input value through unchanged.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | ANY | Yes | — | Any value to pass through unchanged. | | meta_bundle | BUNDLE | Yes | — | The bundle to embed into the saved PNG metadata. | | mode | COMBO | No | overwrite | overwrite = replace any existing meta_bundle entirely. merge = combine with an existing bundle — new keys override old ones, keys not present in the new bundle are kept. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | The input value, passed through unchanged. |

Resize Modes

All three loaders share the same resize pipeline, available via the resize dropdown:

| Mode | Description | |---|---| | off | No resize — load at original dimensions. | | scale dimensions | Scale to exact width × height. Optional center crop to avoid stretching. | | scale by multiplier | Scale both dimensions by a float multiplier. | | scale longer dimension | Scale so the longer side equals the given size, preserving aspect ratio. | | scale shorter dimension | Scale so the shorter side equals the given size, preserving aspect ratio. | | scale width | Scale to a specific width, preserving aspect ratio. | | scale height | Scale to a specific height, preserving aspect ratio. | | scale total pixels | Scale to a target megapixel count. | | make divisible by | Round dimensions to the nearest multiple (e.g. 16 for WAN). |

All modes include a divisible_by option and separate scale method selectors for upscaling and downscaling:

| Scale Method | Best for | |---|---| | nearest-exact | Fastest, pixel art / sharp pixel edges | | bilinear / bicubic | General purpose | | area | Downscaling — sharp, minimal aliasing | | lanczos | Upscaling — smooth, good detail retention | | mitchell-netravali | Sharp upscaling with minimal ringing | | bilinear (antialias) / bicubic (antialias) | Smooth downscaling with anti-aliasing | | nvidia-rtx-vsr | AI upscaling — requires an NVIDIA RTX GPU and the nvidia-vfx package |


Lora

Nifty Lora Loader

Applies a full LoRA stack to a model and CLIP in one node. Each row has its own enable toggle and strength slider. Rows with strength 0.0 or disabled are skipped entirely.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | model | MODEL | Yes | — | Base model to apply LoRAs to. | | clip | CLIP | No | — | CLIP model to apply LoRAs to. | | loras | NIFTY_LORA_LOADER | Yes | — | LoRA stack widget. Add rows, pick a LoRA file, set strength and toggle enabled. Strength 1.0 = full effect, 0.5 = half, negative values invert. |

Outputs

| Name | Type | Description | |---|---|---| | MODEL | MODEL | Model with all enabled LoRAs applied in order. | | CLIP | CLIP | CLIP with all enabled LoRAs applied in order. |

Nifty Lora Stack

Builds a reusable NIFTY_LORA_STACK wire that can be passed to Nifty Apply Lora Stack. Accepts an optional incoming stack to chain multiple Lora Stack nodes together — new rows are appended. Rows with strength 0.0 or disabled are skipped.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | lora_stack | NIFTY_LORA_STACK | No | — | Existing stack to extend. New rows are appended after it. | | loras | NIFTY_LORA_LOADER | Yes | — | LoRA stack widget. Add rows, pick a LoRA file, set strength and toggle enabled. Strength 1.0 = full effect, 0.5 = half, negative values invert. |

Outputs

| Name | Type | Description | |---|---|---| | lora_stack | NIFTY_LORA_STACK | Combined LoRA stack ready to be passed to Nifty Apply Lora Stack. |

Nifty Apply Lora Stack

Applies a NIFTY_LORA_STACK to a model and optional CLIP. Separates stack definition from application — useful when the same stack needs to be applied to multiple models or at different points in a workflow.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | lora_stack | NIFTY_LORA_STACK | Yes | — | The LoRA stack to apply. | | model | MODEL | Yes | — | Base model to apply LoRAs to. | | clip | CLIP | No | — | CLIP model to apply LoRAs to. |

Outputs

| Name | Type | Description | |---|---|---| | MODEL | MODEL | Model with all LoRAs from the stack applied in order. | | CLIP | CLIP | CLIP with all LoRAs from the stack applied in order. |


Conditioning

Nifty CLIP Text Encode (Prompt)

Encodes positive and negative text prompts using a CLIP model in a single node. Both outputs are CONDITIONING wires ready for a sampler.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | clip | CLIP | Yes | — | The CLIP model used for encoding the text. | | positive | STRING | No | | Positive text prompt. Leave empty for an unconditional embedding. | | negative | STRING | No | | Negative text prompt. Leave empty for an unconditional embedding. |

Outputs

| Name | Type | Description | |---|---|---| | positive | CONDITIONING | Positive conditioning from the encoded prompt. | | negative | CONDITIONING | Negative conditioning from the encoded prompt. |


Model

WAN-specific model patching nodes. Both are marked experimental and live in the nifty/model category.

Wan Video NAG

Applies Normalized Attention Guidance (NAG, NeurIPS 2025) to WAN 2.1 / 2.2 video models (T2V and I2V). Replaces or complements CFG by applying guidance directly in attention space — stable at low step counts. Forked and significantly reworked from KJNodes.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | enable | BOOL | No | True | When False, model and conditioning pass through unchanged. | | model | MODEL | Yes | — | WAN model to patch. | | conditioning | CONDITIONING | Yes | — | Negative conditioning (empty or negative prompt). NAG uses this as its internal reference — the direction guidance is pushed away from in attention space. Do not connect positive conditioning here. | | nag_scale | FLOAT | No | 11.0 | Guidance strength (φ), analogous to CFG scale. Good range: 8–15. 0 disables NAG. Tune last — settle on nag_tau and nag_alpha first. | | nag_alpha | FLOAT | No | 0.25 | Blend weight (α) between NAG-guided and original positive attention. 0 = no effect, 1 = full NAG. Lower for I2V (0.10–0.20) to preserve the reference image. | | nag_tau | FLOAT | No | 2.5 | L1-norm clipping threshold (τ): caps how far guided attention deviates from positive attention. Lower = safer. Higher = stronger. Lower for I2V (1.5–2.0); higher for few-step Lightning LoRA (3–5). | | nag_sigma_end | FLOAT | No | 0.0 | NAG is skipped when sigma drops below this value. 0.0 = always active (correct for two-model HN/LN pipelines). For single-model pipelines, 0.75 gives near-identical quality with less compute. | | nag_scale_end | FLOAT | No | 0.0 | Adaptive scale end: linearly interpolates from nag_scale (sigma=1.0) to this value (sigma=0.0). 0.0 = disabled (constant scale). | | input_type | COMBO | No | default | default = sampler sends a [positive, negative] batch pair (standard CFG). batch = single conditioning without a paired negative (use for CFG=1 / few-step WAN with Lightning LoRA). | | inplace | BOOL | No | False | Modify tensors in-place to reduce peak VRAM. Slightly alters numerical results — enable only if out of memory. | | cond_zero_out | BOOL | No | True | Output a zeroed neutral conditioning instead of the input conditioning. Recommended — NAG handles guidance internally so the sampler's negative slot should be empty to avoid interference. Disable only if intentionally stacking NAG on top of CFG. |

Outputs

| Name | Type | Description | |---|---|---| | MODEL | MODEL | Patched model with NAG applied to every cross-attention block. | | CONDITIONING | CONDITIONING | The input conditioning, zeroed out if cond_zero_out is True. |

Recommended Starting Values

| Scenario | nag_scale | nag_tau | nag_alpha | |---|---|---|---| | T2V multi-step | 11 | 2.5 | 0.25 | | T2V few-step (Lightning LoRA) | 11–15 | 2.5–5 | 0.25–0.5 | | I2V (any) | 11 | 1.5–2.0 | 0.10–0.20 |

Nifty Wan Video SLG

Applies Spatiotemporal Skip Guidance (STG / SLG) to WAN video models. No TeaCache required. Works at CFG=1 (e.g. LightX2V). Paper: arxiv 2411.18664 (CVPR 2025). Forked and significantly reworked from KJNodes.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | enabled | BOOL | No | True | When False, the model is passed through unchanged. | | model | MODEL | Yes | — | WAN model to patch. | | blocks | STRING | No | 9, 10 | Comma-separated block indices. Supports ranges (9-11 = 9, 10, 11). WAN 2.2 has 40 layers. Blocks 9, 10 are empirically recommended. Start with 10 alone if flickering occurs. | | mode | COMBO | No | STG-A | STG-A — zeros self-attention only (cross-attn and FFN still run). Less perturbation, lower flickering risk. Recommended for WAN + few-step. STG-R — entire block becomes identity. Stronger but more prone to flickering at 2–3 steps. | | scale | FLOAT | No | 1.0 | Guidance strength. Works at CFG=1. LightX2V (2–3 HN steps): STG-A max ~2.0–2.5, STG-R max ~1.5. | | start_percent | FLOAT | No | 0.0 | Start of active range as a fraction of the full denoising schedule (HN + LN combined). Percentages are absolute. | | end_percent | FLOAT | No | 1.0 | End of active range. Formula: HN_steps / total_steps. 4-step (2+2): 0.5. Default 1.0 = active for all sigmas this model processes. | | rescaling_scale | FLOAT | No | 0.0 | Normalises correction std to match cond_pred std before applying scale. 0.0 = disabled. 0.3–0.5 recommended if scale causes flickering. | | scale_end | FLOAT | No | 0.0 | Adaptive scale end: interpolates from scale at start_percent to scale_end at end_percent. 0.0 = disabled (constant scale). |

Outputs

| Name | Type | Description | |---|---|---| | MODEL | MODEL | Model with a post_cfg_function patched in to apply STG on each sampler step. |


Logic

A full set of flow control nodes. Most come in two variants: lazy (only evaluates the branch that will actually be used) and eager (evaluates both branches regardless).

Input Switch

Routes one of two inputs to the output based on a boolean. Lazy — the unused branch is never executed.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | on_true | ANY | No | — | Passed through when boolean is True. | | on_false | ANY | No | — | Passed through when boolean is False. | | boolean | BOOL | Yes | — | Selector. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | The selected input value. |

Input Switch (Eager)

Same as Input Switch but both branches are always evaluated.

None Input Switch

Routes between on_exists and on_none depending on whether value is None. Lazy.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | on_exists | ANY | No | — | Passed through when value is not None. | | on_none | ANY | No | — | Passed through when value is None. | | value | ANY | No | — | The value to check. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | The selected branch. |

None Input Switch (Eager)

Same as None Input Switch but both branches are always evaluated.

Index Input Switch

Routes one of up to 16 inputs to the output by index. Lazy — only the selected input is evaluated.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | index | INT | Yes | 1 | Which input to pass through (1–16). | | value1 … value16 | ANY | No | — | Auto-growing input list. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | The value at the selected index, or None if the slot is not connected. |

Index Input Switch (Eager)

Same as Index Input Switch but all inputs are always evaluated.

Output Switch

Routes a single input to either on_true or on_false. The unselected output is blocked (downstream nodes do not execute).

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | ANY | Yes | — | Value to route. | | boolean | BOOL | No | True | True = route to on_true, False = route to on_false. |

Outputs

| Name | Type | Description | |---|---|---| | on_true | ANY | Active when boolean is True, blocked otherwise. | | on_false | ANY | Active when boolean is False, blocked otherwise. |

None Output Switch

Routes input to either on_exists or on_none depending on whether value is None.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | ANY | No | — | Value to route. | | value | ANY | No | — | Value to check for None. |

Outputs

| Name | Type | Description | |---|---|---| | on_exists | ANY | Active when value is not None. | | on_none | ANY | Active when value is None. |

Index Output Switch

Routes a single input to one of up to 16 outputs by index. All other outputs are blocked.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | ANY | No | — | Value to route. | | index | INT | Yes | 1 | Which output to route to (1–16). |

Outputs

| Name | Type | Description | |---|---|---| | value1 … value16 | ANY | Only the output at index is active; all others are blocked. |

Signal Switch

Simple on/off gate. When passthrough is False, the output is blocked and all downstream nodes skip execution.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | ANY | Yes | — | Value to gate. | | passthrough | BOOL | No | True | True = pass through, False = block. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | The input value, or blocked if passthrough is False. |

First Switch

Returns the first non-None value from a list of up to 16 inputs. Lazy — inputs are evaluated one by one until a non-None value is found.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | value1 … value16 | ANY | No | — | Auto-growing input list checked in order from top to bottom. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | First non-None value found, or None if all inputs are None. |

String Compare

Compares a string against a match value and returns a boolean.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | string | STRING | Yes | — | The string to test. | | match | STRING | Yes | `` | The value to compare against. An empty match always returns False. | | comparison | DYNAMIC | Yes | exact | exact = full equality · contains = substring · starts with / ends with = prefix/suffix · regex = regular expression | | case_sensitive | BOOL | No | False | Enable case-sensitive comparison. | | negate | BOOL | No | False | Invert the result. |

Outputs

| Name | Type | Description | |---|---|---| | BOOL | BOOL | Result of the comparison. |

Number Compare

Compares two numbers and returns a boolean.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | a | INT / FLOAT | Yes | — | Left-hand operand. | | b | INT / FLOAT | Yes | — | Right-hand operand. | | comparison | DYNAMIC | Yes | a == b | a == b · a != b · a < b · a > b · a <= b · a >= b · a <= b <= c (range check) | | negate | BOOL | No | False | Invert the result. |

Outputs

| Name | Type | Description | |---|---|---| | BOOL | BOOL | Result of the comparison. |

Is None

Returns True if the input is None (not connected or explicitly None).

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | ANY | No | — | Value to check. | | negate | BOOL | No | False | Invert — returns False when None, True otherwise. |

Outputs

| Name | Type | Description | |---|---|---| | BOOL | BOOL | True if input is None, False otherwise (before negation). |

Int Switch / Float Switch / String Switch

Each returns one of two primitive values based on a boolean.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | boolean | BOOL | No | True | Selector. | | on_true | INT / FLOAT / STRING | No | 0 / 0.0 / | Returned when `boolean` is `True`. | | on_false | INT / FLOAT / STRING | No | 0 / 0.0 / | Returned when boolean is False. |

Combo Switch

Switches between two combo (dropdown) values based on a boolean. Each side has its own options list, defined as a pipe-separated string (option1|option2|option3). Also outputs the selected value as a STRING and the index within its option list.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | boolean | BOOL | No | True | Selector. | | on_true | COMBO | No | — | Selected value when True. | | true_options | STRING | No | — | Available options for on_true, separated by \|. | | on_false | COMBO | No | — | Selected value when False. | | false_options | STRING | No | — | Available options for on_false, separated by \|. |

Outputs

| Name | Type | Description | |---|---|---| | COMBO | COMBO | Selected combo value. | | string | STRING | The selected combo value as a string. | | index | INT | Index of the selected value within its option list. -1 if not found. |

Index Combo Switch

Like Index Input Switch but selects the active branch via a named dropdown instead of a raw integer. Each branch gets a custom label defined by the option1option16 string inputs — the dropdown (choise) is built from those labels at runtime. Lazy — only the selected branch is evaluated.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | values | ANY | No | — | Auto-growing input list. Only the selected branch is evaluated (lazy). | | choise | COMBO | Yes | — | Dropdown showing the labels defined by option1option16. | | option1 … option16 | STRING | No | Option N | Label for each corresponding value input. Defines the available dropdown options. |

Outputs

| Name | Type | Description | |---|---|---| | output | ANY | Value of the selected branch, or None if not connected. | | COMBO | COMBO | The selected label as a COMBO value. | | string | STRING | The selected label as a string. | | index | INT | 0-based index of the selected option. -1 if not found. |

Index Combo Switch (Eager)

Same as Index Combo Switch but all inputs are always evaluated regardless of which option is selected.

Boolean AND / OR / XOR

Standard two-input boolean gates.

Boolean AND All / OR Any

Multi-input variants using an auto-growing input list (up to 16). AND All returns True only if every connected input is True. OR Any returns True if at least one is True.

Boolean NOT

Inverts a boolean value.

None

Outputs a None value. Useful as an explicit empty input for optional slots.


Image

Image Color Match

Transfers the color distribution of a reference image onto a target image. Supports 10 transfer methods, selective channel transfer, adjustable strength and batch multithreading.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | image_target | IMAGE | No | — | Image whose colors will be adjusted. | | image_ref | IMAGE | No | — | Reference image providing the color distribution. | | enabled | BOOL | No | True | When disabled, image_target passes through unchanged. | | method | COMBO | No | mkl | Color transfer algorithm — see Methods below. | | transfer_mode | COMBO | No | all | all = full color transfer · color = hue/chroma only, keep original luminance · luminance = brightness only, keep original colors | | strength | FLOAT | No | 1.0 | Blend amount. 1.0 = full match, 0.5 = half-way blend, values above 1.0 exaggerate the effect. Range 0.0–10.0. | | multithread | BOOL | No | True | Process batch frames in parallel using multiple CPU threads. Recommended for large batches. |

Outputs

| Name | Type | Description | |---|---|---| | IMAGE | IMAGE | Color-matched image batch. None if either input is not connected. |

Color Match Methods

| Method | Notes | |---|---| | mkl | Monge-Kantorovich linear map — best overall quality, recommended default for most use cases | | reinhard_lab | Fast statistical LAB match — good for natural/photographic content where speed matters. CPU only | | reinhard_lab_gpu | Same quality as reinhard_lab but GPU-accelerated — prefer this over reinhard_lab when kornia is available. Requires kornia | | wavelet | Transfers low-frequency color while preserving structure — best when texture and fine detail must stay intact | | adain | Adaptive instance normalisation — fast and consistent, well suited for video/animation frame batches | | hm | Histogram matching — fast broad tonal correction, less accurate for complex or saturated palettes | | reinhard | Classic Reinhard RGB — quick and simple, struggles with complex colour distributions | | mvgd | Multivariate Gaussian — high-accuracy statistical match, good complement to mkl for tricky scenes. Requires color-matcher | | hm-mvgd-hm | Histogram + MVGD combo — robust for challenging distributions when mkl alone falls short. Requires color-matcher | | hm-mkl-hm | Histogram + MKL combo — highest overall quality among the combo methods. Requires color-matcher |

Merge Image Batches

Concatenates two image batches with optional blending at the transition. Useful for stitching video segments.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | source_images | IMAGE | No | — | First batch. | | new_images | IMAGE | No | — | Second batch, appended after source. | | overlap_mode | DYNAMIC | No | none | Transition mode — see below. |

| Overlap Mode | Description | |---|---| | none | Simple concatenation, no blending. | | cut | Remove overlap frames from the selected side before concatenating. | | linear_blend | Simple linear crossfade over the overlap region. | | ease_in_out | S-curve (smoothstep) crossfade — more natural motion. | | filmic_crossfade | Gamma-correct (2.2) crossfade — preserves perceived brightness. | | perceptual_crossfade | LAB color space crossfade — perceptually even transition. Requires kornia. |

Outputs

| Name | Type | Description | |---|---|---| | images | IMAGE | Merged batch. None if both inputs are disconnected. |

Resize Image

Resizes an image or mask using the full Nifty resize pipeline. Accepts both IMAGE and MASK types.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | input | IMAGE / MASK | Yes | — | Image or mask to resize. | | resize | DYNAMIC | Yes | — | Resize mode — see Resize Modes. |

Outputs

| Name | Type | Description | |---|---|---| | resized | IMAGE / MASK | Resized output (same type as input). | | width | INT | Output width. | | height | INT | Output height. |

Image From Batch

Extracts a slice from an image batch by start index and length.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | image | IMAGE | Yes | — | Input batch. | | batch_index | INT | No | 0 | Start index. Positive = from beginning, negative = from end (-1 = last image). Range −4096–4096. | | length | INT | No | 1 | Number of images to take. -1 = all from start to end of batch. Range −1–4096. |

Outputs

| Name | Type | Description | |---|---|---| | IMAGE | IMAGE | Extracted slice. |

Last Image From Batch

Shortcut to take the last N images from a batch.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | image | IMAGE | Yes | — | Input batch. | | length | INT | No | 1 | Number of images to take from the end (1–4096). |

Outputs

| Name | Type | Description | |---|---|---| | IMAGE | IMAGE | Last length images from the batch. |


Latent

VAE Encode

Encodes an image batch into latents. Automatically detects the temporal compression factor of the VAE and can optionally encode only a subset of frames specified by a target latent count.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | pixels | IMAGE | Yes | — | Image frames to encode. | | vae | VAE | Yes | — | VAE model to use for encoding. | | target_latents | INT | No | 0 | 0 = encode all frames. Positive = encode only the first N latents' worth of frames. Negative = encode only the last N latents' worth. The temporal factor is detected automatically from the VAE. |

Outputs

| Name | Type | Description | |---|---|---| | LATENT | LATENT | Encoded latent samples. | | IMAGE | IMAGE | The original pixel frames, passed through unchanged. |

Normalize Video Latent Start

Normalises the statistics (mean and standard deviation) of the first few latent frames to match the subsequent frames. Helps reduce flicker or discontinuity at the beginning of a generated video.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | latent | LATENT | Yes | — | Video latent to process. Passthrough if the latent has only 1 frame. | | enabled | BOOL | No | True | When disabled, the latent is passed through unchanged. | | start_frame_count | INT | No | 4 | Number of latent frames from the start to normalise (1–max). | | reference_frame_count | INT | No | 5 | Number of frames immediately after the start region to use as the normalisation reference (1–max). |

Outputs

| Name | Type | Description | |---|---|---| | LATENT | LATENT | Latent with normalised start frames. |

Latent From Batch

Extracts a slice from a latent batch by start index and length. Supports both 4D (image) and 5D (video) latents.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | samples | LATENT | Yes | — | Input latent batch. | | batch_index | INT | No | 0 | Start index. Positive = from beginning, negative = from end (-1 = last frame). Range −4096–4096. | | length | INT | No | 0 | 0 = all from start to end. Positive = first N frames. Negative = trim N frames from the opposite end (e.g. -1 = all except the last). |

Outputs

| Name | Type | Description | |---|---|---| | LATENT | LATENT | Extracted latent slice. |

Last Latent From Batch

Shortcut to take the last N latents from a batch.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | samples | LATENT | Yes | — | Input latent batch. | | length | INT | No | 1 | Number of latents to take from the end (1–4096). |

Outputs

| Name | Type | Description | |---|---|---| | LATENT | LATENT | Last length latents from the batch. |


Sampling

Nifty Random Noise

Generates reproducible random noise from a seed for use with advanced sampler nodes that accept a NOISE input.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | seed | INT | No | 0 | Seed value for noise generation (0–1125899906842624). |

Outputs

| Name | Type | Description | |---|---|---| | NOISE | NOISE | Noise object ready for use in an advanced KSampler node. |


Selectors

Lightweight selector nodes that output a filename or name string. They exist to keep your actual loader nodes clean — connect these to a loader and swap models or settings without touching the loader itself.

Diffusion Model Selector

Selects a diffusion model file from the unet / diffusion_models folder. Supports .safetensors, .gguf, .pt, .pth, .bin.

Outputs

| Name | Type | Description | |---|---|---| | model | ANY | Selected model filename string. | | is_gguf | BOOL | True if the selected file has a .gguf extension. |

Clip Selector

Selects a CLIP / text encoder model file from the clip / text_encoders folder.

Outputs

| Name | Type | Description | |---|---|---| | clip | ANY | Selected model filename string. | | is_gguf | BOOL | True if the selected file has a .gguf extension. |

CLIP Type Selector

Selects a CLIP type string from a dropdown. Covers all model families supported by ComfyUI's dual-CLIP loader (stable_diffusion, wan, flux2, sd3, and many more). Connect the output to a CLIP loader's type input.

Outputs

| Name | Type | Description | |---|---|---| | type | ANY | The selected CLIP type as a string. |

Sampler Selector

Selects a sampler name from the full list of available ComfyUI samplers.

Scheduler Selector

Selects a scheduler name from the full list of available ComfyUI schedulers.


String

Any To String

Converts one or more values of any type to a single string. Booleans become true/false, None becomes "none", everything else uses str().

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | value1 … value16 | ANY | No | — | Auto-growing list of values to convert. None values are excluded. | | mode | DYNAMIC | No | delimiter | delimiter = join all values with a separator string · pattern = insert values into a template using $1, $2, … placeholders (e.g. "$1_$2" with hello and world"hello_world") |

Outputs

| Name | Type | Description | |---|---|---| | string | STRING | Resulting string. |

String Split

Splits a string into a list by a delimiter.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | string | STRING | Yes | — | String to split. Must be connected. | | delimiter | STRING | No | \n | Split character or string. Use \n for newline, \t for tab. | | trim | BOOL | No | False | Trim leading and trailing whitespace from each part. |

Outputs

| Name | Type | Description | |---|---|---| | list | STRING | List of string parts. |

String Join

Joins a list of strings into a single string.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | list | STRING | Yes | — | List to join. Must be connected. | | delimiter | STRING | No | \n | Separator inserted between each item. Use \n for newline, \t for tab. |

Outputs

| Name | Type | Description | |---|---|---| | string | STRING | Joined string. |

Nifty Dynamic Prompt

Generates a resolved prompt string from a template using the dynamicprompts library. Supports wildcard files, random choices, weighted variants, combinatorial expansion and more — see the dynamicprompts documentation for the full syntax.

Wildcards are text files containing one option per line. Place them in your ComfyUI user directory at user/default/wildcards/ (create the folder if it doesn't exist). Reference them in your template with double underscores: __style__ loads user/default/wildcards/style.txt. Subdirectories work too: __artists/painters__ loads user/default/wildcards/artists/painters.txt.

The seed input makes generation deterministic — the same template and seed always produce the same result. If dynamicprompts is not installed, the template is returned unchanged.

The prompt field acts as a manual override: if it contains text, it is passed through directly without running the generator. Clear it to re-generate from template.

See full syntax reference: https://pypi.org/project/dynamicprompts/

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | prompt | STRING | No | | Manual prompt override (socketless). If non-empty, bypasses the template generator and passes this value through directly. | | template | STRING | No | | Dynamic prompt template (socketless). Used when prompt is empty. Supports wildcard syntax, {a\|b\|c} choices, weights, ranges and more. | | enabled | BOOL | No | True | When False, prompt and template pass through unchanged without generation. | | seed | INT | No | 0 | Deterministic seed. Same template + seed always produces the same output. |

Outputs

| Name | Type | Description | |---|---|---| | prompt | STRING | The resolved final prompt string. | | template | STRING | The original template, passed through unchanged. | | seed | INT | The seed value, passed through unchanged. |


Number

Nifty Math

Evaluates a free-form mathematical expression using up to 16 named inputs (ap). Unconnected slots default to 0. The result is cast to all three output types simultaneously.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | a … p | INT / FLOAT | No | 0 | Auto-growing variable inputs. The first two (a, b) are always visible; additional slots appear as needed up to 16. | | expression | STRING | Yes | a + b | Expression to evaluate. See supported syntax below. |

Outputs

| Name | Type | Description | |---|---|---| | int | INT | Result cast to integer (truncated, not rounded). | | float | FLOAT | Result as a float. | | boolean | BOOL | False if result is 0 or 0.0, True otherwise. |

Supported Syntax

| Category | Examples | |---|---| | Arithmetic | a + b, a - b, a * b, a / b, a // b, a % b, a ** b | | Comparisons | a == b, a != b, a < b, a > b, a <= b, a >= b | | Boolean logic | a and b, a or b, not a | | Ternary | a if a > 0 else b | | Math functions | abs, round, min, max, pow, sqrt, floor, ceil, log, log2, log10, exp | | Trig | sin, cos, tan, asin, acos, atan, atan2, radians, degrees, hypot | | Helpers | clamp(v, lo, hi), lerp(a, b, t), remap(v, a, b, c, d) | | Constants | pi, tau, e, inf |

Division by zero returns 0. Any other expression error raises a descriptive exception.


Nifty Seed

A seed node with integrated New Seed and Random on Prompt controls. Clicking New Seed immediately randomises the seed. Random on Prompt automatically generates a new random seed every time the queue is triggered.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | seed | INT | No | 0 | Seed value (0–1125899906842624). |

Outputs

| Name | Type | Description | |---|---|---| | seed | INT | The seed value, clamped to the valid range. |


Utils

Experimental workflow organisation and debugging nodes.

Hidden Link

Passes any value through unchanged while hiding the connection wire on the incoming side. Useful for keeping graphs readable when a connection has to cross a large distance.

Bypass By Title

Bypasses a set of nodes by title when a boolean is True. Node titles are matched case-insensitively and support partial matches.

Inputs

| Name | Type | Required | Default | Description | |---|---|---|---|---| | bypass | BOOL | No | False | When True, the listed nodes are bypassed. | | nodes | STRING | No | `` | Node titles to bypass, one per line. | | search_from_root | BOOL | No | True | Search in the root graph even when called from inside a subgraph. | | enforce | BOOL | No | True | Actively enforce the bypass state so it cannot be overridden. |

Bypass Switch By Title

A multi-option version of Bypass By Title. Each option has its own label and list of nodes to bypass. Selecting an option bypasses all nodes in that option's list and activates the others.

Node Chain Extender

Dynamically duplicates a node and chains the copies together, connecting specified slots between adjacent links.

Subgraph Labels

Assigns display labels to up to 10 subgraph ports. Experimental — requires subgraph support in your ComfyUI version.

Simple Title

A display-only node showing a text label in the graph. Useful for annotating sections of a workflow.

Debug Any

Displays any value as a text preview below the node. Primitives are shown as-is; complex types are serialized to JSON.

Preview Any

Displays up to 16 values simultaneously as inline text previews. For image tensors, shows a summary (N images, WxH) rather than rendering the images.