Extensions/ComfyUI-LogicUtils
ComfyUI Extension

ComfyUI-LogicUtils

Logical Utils (compare, string, boolean operations) for ComfyUI

By aria1th·Created 3 years ago·Updated 7 months ago· 116
aria1th/ComfyUI-LogicUtils
Nodes153
On cloudLocal install
CategoryMath, Logic Gates
Stars116
Updated7 months ago

Nodes (153)

Abs

Strip the sign off a number, integer or float

Math
Add Values

Add Values (AddNode) — ComfyUI-LogicUtils

Logic Gates
Base64 Decode to Image

Base64 Decode to Image (Base64DecodeNode) — ComfyUI-LogicUtils

image
Image to Base64 Encode

Turn an IMAGE into a base64 string for APIs and webhooks

image
Base64 to String Decode

Unwrap a base64 payload back to text

image
Brightness

A one-slider brightness adjustment

image
Ceil

Round any number up to the next whole integer

Math
Censor Image by Rating

Auto-blur based on a booru rating classifier

image
Color

Dial saturation up or down with a single factor

image
Compose RGBA Image From Mask

Compose RGBA Image From Mask (ComposeRGBAImageFromMask) — ComfyUI-LogicUtils

image
Concat Grid (Batch to single grid)

Stitch a whole image batch into one contact-sheet grid

image
Concat 2 Images to Grid

Put two images side by side (or stacked) automatically

image
Contrast

A one-slider contrast adjustment, no color-correct node needed

image
Convert to Boolean

Convert to Boolean (ConvertAny2Boolean) — ComfyUI-LogicUtils

Conversion
Convert to Dict

Force any wired value into a Python dict

Conversion
Convert to Float

Cast any value into a float

Conversion
Convert to Int

Force any wired value into a plain integer

Conversion
Convert to List

Wrap anything into a Python list, mainly for loop nodes

Conversion
Convert to Set

Turn a wired value into a Python set

Conversion
Convert to String

Convert to String (ConvertAny2String) — ComfyUI-LogicUtils

Conversion
Convert to Tuple

Build the tuple that loop nodes actually want

Conversion
Convert Combo to String

Turn a dropdown or list value into text

Logic Gates
Convert Greyscale

Drop an image to greyscale in one node

image
Convert RGB

Convert RGB (ConvertRGBNode) — ComfyUI-LogicUtils

image
Counter Float

Counter Float (CounterFloat) — ComfyUI-LogicUtils

Logic Gates
Counter Integer

A value that counts up every time you run

Logic Gates
Current Timestamp

The current date and time as a formatted string

Logic Gates
Debug Combo Input

A bare dropdown that hands back your pick as a string

Misc
Pyobjects/Create Dict

Start a Python dict from scratch, right inside your graph

Data
Pyobjects/Dict Get

Pull one value out of a dict by key

Data
Pyobjects/Dict Items

Get a dict's key-value pairs as a list

Data
Pyobjects/Dict Keys

List every key in a dict

Data
Pyobjects/Dict Merge

Combine two dicts into one, with an in-place option

Data
Pyobjects/Dict Pointer

Hold a live reference to a dict across your graph

Data
Pyobjects/Dict Remove Key

Delete one key from a dict and keep going

Data
Pyobjects/Dict Set

Write a key/value pair into a dict

Data
Pyobjects/Dict Values

Pull every value out of a dict as a list

Data
Random Width/Height with Resolution

Seeded aspect-ratio picker for batches

Logic Gates
Divide

Divide (DivideNode) — ComfyUI-LogicUtils

Math
Dump Text JSONL Node

Append text to a JSONL file, straight from your graph

text
ErrorNode

Fail a ComfyUI run on purpose, with a message you actually wrote

Misc
FFT Image

Filter an image in frequency space, not pixel space

image
Filter Tags

Strip specific tags out of a Danbooru-style tag string

safety
Floor

Round any number down to the next whole integer

Math
Get All Tags Above Threshold

Auto-tag an image with the full Danbooru tag set

tagger
Get All Tags Above Threshold Except Characters

Tag an image without naming who's in it

tagger
Get Chars Above Threshold From Text

Same character tagger, a name that oversells it

tagger
Get Chars Above Threshold

Find out which named character is in the image

tagger
Get Image Info

Read width, height, and pixel count off an image

image
Length of String

The one-line character counter this pack is built around

Logic Gates
Get Rating Class From Text

Classify an image by file path, for batch scripts

tagger
Get Rating Class

Find out if an image reads as safe, questionable, or explicit

tagger
Get Tags Above Threshold From Text

Another tagger node whose name outruns its schema

tagger
Get Tags Above Threshold

The everyday Danbooru auto-tagger for a single image

tagger
Pyobjects/Global Var Get

Read back a value another node stashed earlier in the graph

Data
Pyobjects/Global Var Load

Pull a value back out of the JSON file Global Var Save wrote

Data
Pyobjects/Global Var Remove

Clear a stashed value so the next run starts clean

Data
Pyobjects/Global Var Save

Write a value to disk so it survives a ComfyUI restart

Data
Pyobjects/Global Var Set If Not Exists

Initialize a value once, keep it across runs

Data
Pyobjects/Global Var Set

Stash a value under a key to use elsewhere in the graph

Data
Download Image from URL

Download Image from URL (ImageFromURLNode) — ComfyUI-LogicUtils

image
Invert Image

A straight negative, one input, one output

image
Is Prime?

The node this entire pack started as a joke about

Math
Pyobjects/PyStructure -> JSON

Dump whatever's actually inside a socket to text

Data
Pyobjects/PyObject -> JSON

Turn any Python object flowing through your graph into a string

Data
Pyobjects/JSON -> PyObject

Turn a JSON string into a live Python object

Data
Pyobjects/List Append

Add one item to the end of a list

Data
Pyobjects/Create List

The empty list every LogicUtils chain starts from

Data
Pyobjects/List Extend

Merge two lists into one

Data
Pyobjects/List Get

Pull one item out of a list by index

Data
Pyobjects/List Insert

Drop an item into a list at a specific spot

Data
Pyobjects/List Pop

Remove an item and get the shortened list back

Data
Pyobjects/List Remove

Delete an item by value, not position

Data
AAndBGate

A boolean AND gate for your ComfyUI graph

Logic Gates
Bitwise And

Masking bits together without leaving the graph

Logic Gates
Bitwise Not

The bit-flip, not a boolean toggle

Logic Gates
Bitwise Or

Combining integer flags without leaving the graph

Logic Gates
Bitwise Shift

Nudging an integer's bits, direction unconfirmed

Logic Gates
Bitwise Xor

The bit-level toggle

Logic Gates
ABiggerThanB

The lightweight two-number comparison people actually recommend

Logic Gates
AContainsB(String)

It's a regex match, not a plain substring check

Logic Gates
ReturnAorBValue

Return A or B Value (LogicGateEither) — ComfyUI-LogicUtils

Logic Gates
Invert Basic

Flip whatever comes in

Logic Gates
Negate Value

Flip a boolean (or a number's sign) inline

Logic Gates
AOrBGate

Combine two conditions into one clean boolean

Logic Gates
Log

Log (LogNode) — ComfyUI-LogicUtils

Math
Manual Choice Float

A poor man's dropdown for a handful of preset values

Logic Gates
Manual Choice Int

A poor man's dropdown for a handful of preset numbers

Logic Gates
Manual Choice String

Pull one item out of a delimited string by index

Logic Gates
Max

Max (MaxNode) — ComfyUI-LogicUtils

Math
Memory String

A one-slot memory cell that survives between runs

Logic Gates
Merge String

Glue two node outputs into one string

Logic Gates
Min

Take the smaller of two values, no clamp node required

Math
Modulo

The remainder operator as a ComfyUI node

Math
Multiply

Multiply (MultiplyNode) — ComfyUI-LogicUtils

Math
Parse Exif

Read an image's embedded metadata back out as text

Misc
Power

Raise one value to the power of another, type-agnostic

Math
Probability Gate

A seeded coin flip you can wire into your graph logic

Logic Gates
RAMP

The textbook ramp function, one float in and out

Math
Random Gaussian Float

A seeded number drawn from a normal distribution

Logic Gates
Random Shuffle Float

Shuffle a delimited list of numbers, seeded

Logic Gates
Random Shuffle Int

Reorder a delimited list without changing what's in it

Logic Gates
Random Shuffle String

Shuffle a delimited list of strings, seeded

Logic Gates
Replace String

Regex find-and-replace on prompts and text

Logic Gates
Resize Image Ensuring W/H Multiple

Snap dimensions to a clean multiple

image
Resize Image

Force an exact width and height

image
Resize Image With Resolution

One number, aspect ratio kept

image
Resize Image With Resolution If Bigger

Downscale-only, skip if already small

image
Resize Image With Resolution If Smaller

Upscale-only, skip if already big enough

image
Resize Longest To

Fit an image inside a box, proportions intact

image
Resize Scale Image

Multiply the dimensions by a factor

image
Resize Shortest To

Scale an image by its shortest side, aspect ratio intact

image
Rotate Image

Rotate an image by an angle in degrees

image
Round

Round (RoundNode) — ComfyUI-LogicUtils

Math
Save Custom JPG Node

Write JPEGs with quality and metadata control

image
Save Image Custom Node

Save Image Custom Node (SaveImageCustomNode) — ComfyUI-LogicUtils

image
Save Image Webp Node

Write WebP with quality, compression and metadata control

image
Save Text Custom Node

Write any string to a file on disk

text
Get Image From Prompt (Fallback)

The same A1111-API bridge, for when the primary one won't run

WebUI API
Get Image From Prompt

Call an A1111/Forge instance's REST API from inside ComfyUI

WebUI API
Pyobjects/Set Add

Add one item to a Python set, ComfyUI-native

Data
Pyobjects/Set Clear

Reset a set back to empty without a new Set Create

Data
Pyobjects/Create Set

Start an empty Python set inside your ComfyUI graph

Data
Pyobjects/Set Difference

What's in A that isn't in B

Data
Pyobjects/Set Intersection

Find what two sets have in common

Data
Pyobjects/Set Remove

Drop one item from a Python set in ComfyUI

Data
Pyobjects/Set Symmetric Difference

Everything that's in exactly one of two sets

Data
Pyobjects/Set to List

The bridge back from SET to a type ComfyUI understands

Data
Pyobjects/Set Union

Merge two sets, duplicates handled for free

Data
Sharpness

A one-knob sharpen/blur for any image

image
Sigmoid

Squash any number into 0–1

Math
SleepNode

Pause execution, then pass anything through

Misc
Sleep (Image tunnel)

An inline pause in the middle of a chain

Misc
Static Number Float

A typed float constant

Logic Gates
Static Number Int

Static Number Int (StaticNumberInt) — ComfyUI-LogicUtils

Logic Gates
Static String

A fixed text value as a wire

Logic Gates
String List to Combo

Split a delimited string and pick an item

Logic Gates
String to Base64 Encode

Make any text ASCII-safe

image
System Random Float

System Random Float (SystemRandomFloat) — ComfyUI-LogicUtils

Logic Gates
System Random Gaussian Float

True random noise, no seed

Logic Gates
System Random Int

System Random Int (SystemRandomInt) — ComfyUI-LogicUtils

Logic Gates
UUID Generator

A unique random string for filenames and IDs

Logic Gates
Text Preview

A dead-simple debug window for whatever's flowing through your graph

Misc
Threshold image with value

Threshold Image (ThresholdNode) — ComfyUI-LogicUtils

image
Pyobjects/Cast to LIST

Force a value into a real Python list

Data
Pyobjects/Cast to SET

Dedupe a value into a Python set

Data
Triangular Random Float

Random, but weighted toward a target

Logic Gates
Uniform Random Choice

A poor man's wildcard, one string wide

Logic Gates
Uniform Random Float

A seeded random number generator you can actually reproduce

Logic Gates
Uniform Random Int

Uniform Random Int (UniformRandomInt) — ComfyUI-LogicUtils

Logic Gates
Weighted Random Choice

Pick from a list where some options are more likely than others

Logic Gates
Yieldable (Sequential) Iterator Int

A counter that remembers where it left off between runs

Logic Gates
Yieldable Iterator String

Step through a list instead of picking randomly

Logic Gates
Readme

Logic Utilities for someone who wants

~~prime list calculation in comfyui~~ Proper documentation is being prepared, however there are too many nodes image

Tests

Run from the repo root:

python -m unittest discover -s tests

Notes

  • Auto-install is opt-in via COMFYUI_LOGICUTILS_AUTO_INSTALL=1.
  • To force-disable the install hook, set COMFYUI_LOGICUTILS_SKIP_INSTALL=1.