Extensions/ComfyUI-XJNodes
ComfyUI Extension

ComfyUI-XJNodes

A modular collection of custom nodes for ComfyUI, organized by data type for easy navigation and maintenance.

By alexjx·Created 11 months ago·Updated 4 days ago· 0
alexjx/ComfyUI-XJNodes
Nodes64
On cloudLocal install
CategoryXJNodes/Lists, XJNodes/lora
Stars0
Updated4 days ago

Nodes (64)

Append to Image List (XJ)

Grow an image list one picture at a time — the accumulator for loops

XJNodes/Lists
Conditional Lora Loader

One toggle turns every LoRA in your stack on or off

XJNodes/lora
Context Enter

Hold the model in VRAM while you work, unload it when you're done

XJNodes/util
Context Exit

Tell the model it's done, it can unload now

XJNodes/util
Debug

Drop a labeled breadcrumb in the console without breaking the flow

XJNodes/util
Empty Image List (XJ)

The empty list you need before you can grow one

XJNodes/Lists
Float Range List

Generate a list of floats between two numbers, exactly like a range()

XJNodes/util
Get Image from List (XJ)

Pull one specific image out of a list by index — negatives work

XJNodes/Lists
Image Batch Resize (Pad/Crop)

Batch Resizing Without the Stretch Marks

XJNodes/image
Image Grid

Turn a whole batch of images into one tidy grid, no extra node pack required

XJNodes/image
Image List Filter

Strip the blank frames out of your image list automatically

XJNodes/image
Image List Length (XJ)

How many images are in that list? Ask, don't guess.

XJNodes/Lists
Image List Slice (XJ)

Carve a range out of your image list like Python slicing

XJNodes/Lists
Image Pair Compare

A/B your renders side by side with tabs, like rgthree's comparer

XJNodes/image
Image Preview Bridge

Preview any image and paint a mask on it, right inside the workflow

XJNodes/image
Image Random Transform

Flip, jitter, distort, repeat

XJNodes/image
Image Scale Calc

A scale calculator that hands ComfyUI the numbers it actually wants

XJNodes/image
Image Scale Megapixel

Target a megapixel count, not a lucky scale factor

XJNodes/image
Image to Seed

Make the seed follow the picture, not the other way around

XJNodes/image
Image Transform

Data-augmentation transforms without leaving the graph

XJNodes/image
Integer Decrement

The subtract twin, for when your counter goes the other way

XJNodes/util
Integer Increment

Add a number to an integer, with a wire instead of a widget

XJNodes/util
Int Offset

Seed offset in one node, the way the pack's README intends

XJNodes/util
JSON Extractor

Pull one value out of a JSON blob without a regex in sight

XJNodes/text
Load Image By Path

Load an image by exact path, because 'dynamic' beats 'convenient'

XJNodes/image
Load Images From Dir Batch

Load a whole folder of images as one batch, Inspire-Pack style

XJNodes/image
Load Images From Dir List

Dump a whole folder of images into the graph, sorted and capped

XJNodes/image
Load Image With Metadata

Load an image and get its whole biography back as data

XJNodes/image
Loop End (XJ)

The bottom half of the loop — where the magic (and the quirks) live

XJNodes/Flow
Loop Start (XJ)

The for-loop ComfyUI kept promising you

XJNodes/Flow
Mask Dilate (Circular)

Blow up a mask without turning every corner into a square

XJNodes/segs
Mask Refine (K-Means)

When your mask under-segments, teach it to follow color

XJNodes/segs
Mask Refine (Morph)

The mask grower that knows where edges are

XJNodes/segs
One Image From Batch

Reach into a batch and pull out image number N

XJNodes/util
Random Images From Batch

Grab a random handful from a batch — with a couple of guest-list exceptions

XJNodes/image
Random Text

A random string generator with a character set you control

XJNodes/text
Random Text From File

Random prompts from a file you already keep on disk

XJNodes/text
Random Text From List

A numbered prompt list where fixed, random, and ranged all make sense

XJNodes/text
Sampler Adapter

Turn the sampler dropdown into a wire you can route

XJNodes/util
Save Image With Metadata

The saver that stuffs your prompt, workflow and notes into the file

XJNodes/image
Scheduler Adapter

Stop hand-picking sigmas, let the workflow decide

XJNodes/util
SEGS Auto Adjust Hook

Auto-level the detail pass so it matches the scene

XJNodes/segs/hooks
SEGS Blur Hook

Soften the detail pass when sharp is the wrong call

XJNodes/segs/hooks
SEGS Color Correct HSV Hook

Tune saturation and tone on the detail pass

XJNodes/segs/hooks
SEGS Color Correct RGB Hook

Fix the tint the detail pass left behind

XJNodes/segs/hooks
SEGS Color Match Hook

Stop the detail pass from changing the colors

XJNodes/segs/hooks
SEGS Count

How many segments did the detector actually find?

XJNodes/segs
Dilate Mask (SEGS Expand)

Grow a mask without clipping it at the crop edge

XJNodes/segs
SEGS Extractor

Crack a SEG open into image, mask, and coordinates

XJNodes/segs
SEGS Filter

Keep only the SEGS you actually care about

XJNodes/segs
SEGS Filter By Label

Keep only the faces, drop the hands

XJNodes/segs
SEGS Merge

Collapse a pile of detections into one combined region

XJNodes/segs
SEGS Pick

Grab one segment out of the pile and do something custom

XJNodes/segs
SEGS Refine (K-Means)

Grow masks along real color boundaries

XJNodes/segs
SEGS Refine (Morph)

Grow masks with edges and color keeping them honest

XJNodes/segs
SEGS Sharpen Hook

Unsharp-mask the detail pass before it lands

XJNodes/segs/hooks
SEGS Stitcher

Paste a processed crop back into the original image

XJNodes/segs
SEGS Wildcard Prompt

A different prompt for every detected segment

XJNodes/segs
StringPass

A string that does nothing, and that's the point

XJNodes/util
SUPIR Parameters

Ramp the sampling knobs across a multi-pass upscale

sd
Text File Info

Peek at a prompt file before you use it

XJNodes/text
Text List From File

Turn a text file into a list of prompts

XJNodes/text
Unwrap from List (XJ)

Grab the single value hiding inside a ComfyUI list

XJNodes/Lists
Wrap as List (XJ)

The one-line fix when ComfyUI wants a list and you've got a single value

XJNodes/Lists
Readme

ComfyUI-XJNodes

A modular collection of custom nodes for ComfyUI, organized by data type for easy navigation and maintenance.

Note: This repository is primarily for personal use and experimentation.

Available Nodes

This package provides custom nodes organized into four main categories:

Image Nodes

  • Image Batch Resize (Pad/Crop) (XJNodes/image)
    • Combine up to 8 image inputs into one batch, in input order. Each input may itself be a batch.
    • image_1 is required; image_2 through image_8 may be disconnected or None and are skipped.
    • Set width and height for the output resolution (default: 1024 × 1024).
    • pad: preserve the full image with centered black padding. crop: fill the target and crop excess from the center. Both preserve aspect ratio up to pixel rounding and use bilinear resizing with antialiasing.
    • Inputs must have matching channel counts. For more than 8 inputs, chain nodes using the same resolution.

Loaders:

  • Random Image from Dir (XJNodes/image)

    • Returns one image, its transparency mask, and its absolute file path on each execution.
    • random: visits every image once in shuffled order before reshuffling; avoids an immediate repeat between cycles when there is more than one image.
    • iteration: starts at a random position in the sorted file list, advances one file per execution, and wraps around.
    • Choose input or output and enter a subdirectory, or use Browse Subdirs, matching Load Image With Metadata. Enable recursive to include subdirectories. The selected image appears in the node preview after execution. Supports PNG, JPEG, WebP, BMP, TIFF, and GIF (first frame only), with EXIF orientation applied.
    • Memory is local to the node instance, is not saved in the workflow, and resets when the instance is recreated or the directory, mode, recursive setting, or file list changes. Empty/missing folders and unreadable images raise errors.
  • Load Images From Dir Batch / Load Images From Dir List

    • Load multiple images from a directory as a batch/list, with options for image cap, start index.
    • Allow Recursive loading
    • Inspired by (Dr.Lt.Data's Inspire-Pack)

    LoadImageBatch

  • Load Image With Metadata

    • Load image from input/output directories with full metadata extraction

      • dimensions
      • format
      • PNG text chunks
      • workflow data
      • extra metadata fields

      LoadImageWithMetadata

    • Browser UI for selecting images

      Browser UI

  • Load Image By Path

    • Simple loader that takes directory and filename as string inputs
    • Useful for dynamic loading based on workflow logic (E.g. Loading image path from metadata)

    LoadImageByPath

Savers:

  • Save Image With Metadata

    • Save images with embedded metadata, workflow, and custom metadata fields
    • Options for output directory, filename patterns, and format (PNG/JPEG)
    • Inspired by (WAS's WAS Node Suite)

    SaveImageWithMetadata

Transforms:

  • Image Transform
    • Apply transformations to images with specified parameters
  • Image Random Transform
    • Apply random transformations to images for data augmentation

Scaling:

  • Image Scale Calc
    • Calculate scaling dimensions for images
  • Image Scale Megapixel
    • Scale images to target megapixel resolution

Batch:

  • Image Grid
    • Arrange multiple images into a grid layout
  • One Image From Batch
    • Extract a single image from a batch by index
  • Image List Filter
    • Filter images from a list based on criteria
  • Random Images From Batch
    • Randomly select images from a batch

Compare:

  • Image Pair Compare
    • Compare two image sets with paired selection
    • Numeric tabs (1, 2, 3...) to select corresponding A/B image pairs
    • Slide and Click comparison modes
    • Sliding right reveals A; sliding left reveals B; "Open Image" opens the image with the larger visible area
    • Image size display under each image
    • Inspired by rgthree's Image Comparar

Lora Nodes

  • Conditional Lora Loader
    • Load multiple loras dynamically with a single boolean condition
    • Enable/disable all loras with one toggle
    • Supports multiple lora inputs (lora_1, lora_2, etc.) with individual strength controls
    • Inspired by rgthree's Power Lora Loader

Text Nodes

Loaders:

  • Random Text From List

    • Select text from a numbered list widget (fixed or random selection)
    • Fixed or random selection options
    • Simple YAML-like list syntax
    • Use full-line comments such as # Landscapes as section headings. Click T (Table of contents) in the editor toolbar to list headings with source line numbers, then select one to scroll to and highlight its line. Tab/Enter navigate the buttons; Escape closes the contents. Headings remain excluded from text selection.
    • Useful for prompts, captions, tags, selection.
    • Optional memory (off by default) reduces repeats in random and list modes. Enable it to draw from a shared-across-instances, per-node bag of distinct candidate texts. Selected texts are removed; before the next draw, the bag refills if strictly less than 25% remains. With 60 distinct candidates, the first 46 draws are distinct, then the bag refills on draw 47. Refills avoid immediately repeating the last result when alternatives exist; earlier results can repeat after a refill.
    • Set cache_time to the selection memory idle timeout in seconds (default 7200 = 2 hours, minimum 1). Each draw restarts that bag’s timer. Bags idle for more than their configured timeout are removed on the next memory-enabled draw; restarting ComfyUI clears all bags. This controls selection memory, not ComfyUI’s output cache. Changing candidate texts or their order resets the bag; changing seed does not.
    • Memory is separated by workflow ID (when supplied), node ID, and selection mode. Set a different memory_id per workflow when workflow metadata is unavailable (for example, API submissions); otherwise workflows using the same node ID and mode can share memory. A nonempty memory_id overrides the workflow ID.
    • With memory enabled, duplicate indices/texts count as one candidate, and results depend on both seed and previous draws. Only actual node execution consumes a draw: keep changing seed between runs, since cached outputs do not advance the bag. fixed mode and memory-off selection retain their previous behavior.

    TextFromList

  • Random Text From File

    • Select text from .txt or .md files in input directory (supports comments with #, list items with -)
  • Text List From File

    • Load all valid lines from a text file as a list

Info:

  • Text File Info
    • Get information about text files (line count, etc.)

JSON:

  • JSON Extractor

    • Extract value from JSON data structures
    • Supports x.y.z notation for nested keys
    • Useful for parsing metadata from files.

    JSON Extractor

Primitives

Adapters:

  • Scheduler Adapter
    • Adapter for ComfyUI scheduler compatibility
  • Sampler Adapter
    • Adapter for ComfyUI sampler compatibility
  • StringPass
    • Simple string passthrough utility

Integers:

  • Int Offset

    • Add offset to integer values
    • Add or subtract offset based on parameter
    • Useful for seed offset from main seed.

    Int Offset

  • Integer Increment

    • Increment integer by a value
  • Integer Decrement

    • Decrement integer by a value

Floats:

  • Float Range List
    • Generate a list of float values within a range

Lists:

  • Empty Image List - Create an empty list for accumulation
  • Append to Image List - Add images to a list (handles batch tensors)
  • Get Image from List - Extract single image by index
  • Image List Slice - Extract range of images
  • Image List Length - Get list size
  • Wrap as List / Unwrap from List - Convert between single values and lists

Flow Control

Loop System:

  • Loop Start / Loop End
    • Index-based iteration with up to 20 value slots
    • Featured: Preserves lists as-is - No auto-expansion, lists stay intact through iterations
    • Supports image list accumulation patterns
    • See docs/loop-system.md for implementation details

Specialized

SUPIR:

  • SUPIR Parameters
    • Helper node for SUPIR upscaling workflow parameters

Installation

  1. Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/
  1. Clone this repository:
git clone https://github.com/yourusername/ComfyUI-XJNodes.git
  1. Restart ComfyUI

Requirements

See requirements.txt for any additional dependencies.

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).