Extensions/ComfyUI_SamplingUtils
ComfyUI Extension

ComfyUI_SamplingUtils

DEPRECATED. Install ComfyUI-UtilsCollection instead from https://github.com/silveroxides/ComfyUI-UtilsCollection

By silveroxides·Created 11 months ago·Updated 3 months ago· 20
silveroxides/ComfyUI_SamplingUtils
Nodes63
On cloudLocal install
Categoryutils, advanced
Stars20
Updated3 months ago

Nodes (63)

AdjustedResolutionParameters

Two resolutions from one set of numbers, so base and hires can't disagree

utils
Any List (Primitive)

Bundle a pile of anything into one wire

advanced
CLIP Text Encode with Attention Bias (Experimental)

Weight individual phrases by biasing their attention, not their tokens

advanced/conditioning
Bonus Prompt Presets

Drop in a hand-tuned style paragraph without writing it yourself

advanced/text
Bonus Prompt Video Presets

The same style shelf, rewritten for video models

advanced/text
Camera Shot Presets

Camera language that actually moves the shot, without the typos

advanced/text
Color Convert (Bottom of node is color selector)

One color, three formats, zero guessing

advanced/color
Soft Switch (Inverse)

Pick a branch, or just pass through

logic
Switch (Inverse)

An any-type A/B switch that keeps old workflows alive

logic
Edit Operation Presets

The action half of an edit instruction, pre-written and phrased right

advanced/text
Edit Target Presets

Tell the edit model *what* you're editing, in its own language

advanced/text
Frakturpad

The prompt that reads like 𝕱𝖗𝖆𝖐𝖙𝖚𝖗 to word filters

advanced/text
GetJsonKeyValue

API-key rotation and config lookup from a plain JSON file

advanced/utils
Ideogram 4 Scheduler (Presets)

Ideogram 4's official step counts, as a drag-in sigma node

sampling/custom_sampling/schedulers
IdeographicLinePad

The CJK-aware cousin of Joiner Padding

advanced/text
IdeographicSentencePad

Padding that respects sentence boundaries

advanced/text
IdeographicTagPad

For tag-style prompts and their filters

advanced/text
Image Blend by Mask

The compositing node done right — pure PyTorch, auto-resize, no hunting through other packs

utils/mask
Image_Color_Noise

Procedural color noise in eight flavors, seeded and repeatable

utils
Image Inward Edge Fill

Fill a hole by pulling the surrounding pixels in, not by guessing

advanced/image
Image Iterative Stretch Fill

Stretch the edges inward, telescoping, for holes a single fill can't handle

advanced/image
Image Match Properties

Make a generated image inherit the reference's color and light

advanced/image
ImageScaleAndResolutionPicker

One node that resizes, crops to aspect, and hands you the numbers

utils
Instruct Prompt Presets

Ready-made instruction blocks for image-editing models

advanced/text
Instruct Prompt Video Presets

Instruction blocks rewritten for video-edit conditioning

advanced/text
Random Integer in Range

A random integer you can actually lock down and replay

utils/primitive
Joiner Padding

Invisible characters between every letter

advanced/text
LlTokenizerOptions

The padding knob for LLM-based text encoders

_for_testing/conditioning
Load LoRA for CLIP Only

The one LoRA loader that actually works against a remote CLIP

advanced/model
Modify Mask (Expand/Contract with options)

Grow, shrink, blur, invert, and batch

utils/mask
Multi-Type Demo (Primitive)

Multi-Type Demo (Primitive) is a demo node. Treat it like one.

advanced/primitives
Optical Flow Composite (Global Align)

Paste an AI edit back onto the original without the seam

advanced/image
RandomInt

A random number you can wire to five things at once

utils/primitive
RandomIntRange

Randomness you can reproduce — the seed-friendly integer roller

utils/primitive
StaticInt

Stop typing the same number into five widgets

utils/primitive
Resolution Selector Extended

Stop doing the aspect-ratio math in your head

utilities
SamplingParameters

One node that answers 'what size are my tiles?'

advanced
Text Encode with Flux2 dev System Prompt (Scaled Bias)

`<cat=1.5>`

advanced/conditioning
Text Encode with Flux2 Klein System Prompt (Scaled Bias)

Klein's chat template with per-token emphasis on top

advanced/conditioning
Text Encode with LTXV 2 System Prompt (Scaled Bias)

LTXV 2 conditioning with image reference, system prompt, and bias

advanced/conditioning
Text Encode System Prompt (Scaled Bias)

One encoder, three model templates, zero guessing

advanced/conditioning
Text Encode with Z-Image Thinking Prompt (Scaled Bias)

Inject reasoning into a Z-Image prompt

advanced/conditioning
Text Encode with Z-Image System Prompt (Scaled Bias)

Z-Image's system prompt slot, scaled-bias edition

advanced/conditioning
Inject Noise to Latent SamplingUtils

Precise noise, exactly where you want it

utils/latent
Load Images (Directory)

Load a whole folder of images as a batch

advanced/image
Load Image (Path)

Load an image from anywhere, not just the input folder

advanced/image
System Message Presets

The system prompts this author spent days writing, for free

advanced/text
System Message Video Presets

The same great edit system prompts, but aimed at video

advanced/text
Tag Normalize and Combine

Two taggers, one clean deduped list

advanced/text
Text Encode with Flux2 dev System Prompt

The system prompt slot Flux 2 dev actually wants

advanced/conditioning
Text Encode with Flux2 Klein System Prompt

The correct chat template for Flux 2 Klein, think block included

advanced/conditioning
Text Encode with LTXV 2 System Prompt

The LTX-2 encoder that puts your system prompt where it belongs

advanced/conditioning
TextEncodeSystemPrompt

One text-encode node that understands all the 2026 chat-template models

advanced/conditioning
Text Encode with Z-Image Thinking Prompt

Give Z-Image a thinking block it will actually use

advanced/conditioning
Text Encode with Z-Image System Prompt

The Z-Image encoder with a proper system prompt slot

advanced/conditioning
Text Generate Qwen3.5 (System Prompt)

Run a Qwen3.5 chat inside your graph — braces and all

advanced/textgen
Text Overlay

Burn text onto images without leaving ComfyUI

advanced/image
Load Diffusion Model (Async)

Load Diffusion Model (Async) — the name oversells it, the loader is fine

advanced/model
UnFrakturPad

The cleanup half of the fraktur trick

advanced/text
Unified Presets (Primitive)

One dropdown that drives three prompt families in lockstep

advanced/primitives
VLM System Instruction Advanced Presets

Preset plus your own queries, wrapped in one string

advanced/text
VLM System Instruction Presets

A dropdown of ready-made captioning system prompts

advanced/text
VLM System Query Add Presets

Same node, old name

advanced/text
Readme

DEPRECATED

Install ComfyUI-UtilsCollection instead.

=========================================

ComfyUI_SamplingUtils

A collection of utility nodes for ComfyUI providing sampling parameter management, text encoding with system prompts, mask manipulation, image blending, text edit, and more.

Installation

Place this folder in your ComfyUI/custom_nodes/ directory.

Dependencies

  • pilgram - For image blending modes
  • kornia - For morphological mask operations
  • scipy - For mask hole filling

Nodes

Sampling & Parameters

SamplingParameters

Category: utils

Centralized sampling parameter management node. Outputs width, height, batch size, upscaled dimensions, steps, CFG scale, seed, and calculated tile dimensions for tiled processing.

  • Inputs: width, height, batch_size, scale_by, multiple, steps, cfg, seed
  • Outputs: All input parameters plus computed upscaled_width, upscaled_height, tile_width, tile_height, tile_padding

JSON Utilities

GetJsonKeyValue

Category: utils

Loads values from a JSON key-value file with multiple selection methods. Useful for API key rotation or configuration management.

Key ID Methods:

  • custom - Select a specific key by name
  • random_rotate - Randomly select from available keys
  • increment_rotate - Cycle through keys based on rotation interval

Text Encoding (Conditioning)

TextEncodeSystemPrompt

Category: advanced/conditioning

Unified text encoder supporting multiple model template formats. The recommended node for system prompt injection.

| Model Type | Template Format | Use Case | |------------|-----------------|----------| | flux2dev | [SYSTEM_PROMPT]...[/SYSTEM_PROMPT][INST]{}[/INST] | Flux 2 Dev | | klein | <\|im_start\|>system... with <think> tags | Klein (supports thinking content) | | z-image | <\|im_start\|>system... format | Z-Image models |

TextEncodeFlux2SystemPrompt

Category: advanced/conditioning

Dedicated encoder for Flux 2 models with LLAMA-style system prompt injection.

TextEncodeKleinSystemPrompt

Category: advanced/conditioning

Encoder for Klein models with support for custom thinking content injection.

TextEncodeZITSystemPrompt

Category: advanced/conditioning

Encoder for Z-Image models using the <|im_start|> template format.

SystemMessagePresets

Category: advanced/conditioning

Provides preset system prompts for Flux 2 models:

  • F2_SYSTEM_MESSAGE - Standard system message
  • F2_SYSTEM_MESSAGE_UPSAMPLING_I2I - Image-to-image upsampling prompt
  • F2_SYSTEM_MESSAGE_UPSAMPLING_T2I - Text-to-image upsampling prompt

Mask Operations

ModifyMask

Category: utils/mask

Advanced mask manipulation with expansion, contraction, blurring, and hole filling.

Features:

  • Expand/contract masks using morphological operations
  • Tapered or square corner modes
  • Gaussian blur with original pixel preservation
  • Incremental expansion rate for animated masks
  • Lerp alpha and decay factor for temporal effects
  • Optional hole filling

Image Operations

ImageBlendByMask

Category: utils/mask

Composite images using various Photoshop-style blending modes.

Supported Modes: add, color, color_burn, color_dodge, darken, difference, exclusion, hard_light, hue, lighten, multiply, overlay, screen, soft_light

Image_Color_Noise

Category: utils

Generate procedural noise images with various frequency characteristics.

Noise Types:

  • grey - Grayscale noise
  • white - RGB white noise
  • red, green, blue - Single channel noise
  • pink - 1/f noise (natural frequency distribution)
  • mix - Multi-frequency RGB noise

SU_LoadImagePath

Category: image

Load images from arbitrary file system paths with proper mask handling.

Features:

  • Loads from absolute file paths (not just ComfyUI input folder)
  • Proper alpha channel extraction for RGBA and palette images
  • Full-sized zero mask for images without alpha (not 64x64)
  • 16-bit image support with correct normalization
  • Multi-frame image support (GIFs)
  • EXIF orientation handling

Text Edit

Frakturpad

Category: text

Edits text by converting ASCII letters to Unicode bold fraktur characters (𝕬𝖇𝖈...) and padding with word joiner characters (U+2060). Useful for bypassing text filters while maintaining readability.

UnFrakturPad

Category: text

Reverses the frakturpad operation - removes word joiners and converts bold fraktur back to ASCII.


API Version

This extension uses the ComfyUI V3 API (ComfyExtension, io.Schema).

License

See LICENSE file in the repository root.