ComfyUI Extension: πΈ YFG Comical Nodes
Utility custom nodes for special effects, image manipulation and quality of life tools.
Custom Nodes (18)
- π― YFG 10 Image Switcher
- π― YFG 15 Image Switcher
- π― YFG 20 Image Switcher
- π― YFG Image To Contrast Mask
- π― YFG Image to imgBB
- π― YFG 3 Image Switcher
- π― YFG 5 Image Switcher
- π― YFG Image Halftone Generator
- π― YFG Histograms Generator
- π― YFG Histograms Generator (compact)
- π― YFG Image Side by Side
- π― YFG imgBB to Image
- π― YFG Monochrome Image Clip
- π― YFG PixelArt
- π― YFG Smart Checkpoint Loader
- π― YFG Store URL
- π― YFG Text Mask Overlay
- π― YFG VAE Decode with Preview
README
YFG Comical ComfyUI Custom Nodes
</div>A collection of ComfyUI utility custom nodes. These provide functionality not offered in the core app or other custom nodes. Several nodes enhance existing ideas with improved UX and quality-of-life features.
- YFG Comical ComfyUI Custom Nodes
- Nodes
- Image Histograms Generator
- Image Histograms Generator (compact)
- Image Halftone Generator
- Image Side by Side
- Image to imgBB
- Smart Checkpoint Loader
- Mono Clip
- VAE Decode with Preview
- Image to Contrast Mask
- PixelArt
- Text Mask Overlay
- Image Switchers
- Random.org True Random Number
- Random.org True Random Number (V2)
- Random Image From Directory
- Examples
- All nodes as of 06-13-2024
- Acknowledgements
- Nodes
<small><i><a href="http://ecotrust-canada.github.io/markdown-toc/">Table of contents generated with markdown-toc</a></i></small>
Nodes
Image Histograms Generator

Calculate image histograms for RGB channels and L (luminance); displays a graphical representation.
Image Histograms Generator (compact)

Reduces outputs to just two: Original and Histogram. Can self-preview (original or histogram) and forward the selected histogram downstream.
Image Halftone Generator

Based on original code by Phil Gyford and ComfyUI node by aimingfail.
Generates halftone from an input image; can self-display or send output to other nodes.
Image Side by Side

Creates a side-by-side or split image from two inputs. Optional self-preview, headers (font/size/color), and label toggles.
Example (side-by-side instead of split):

Image to imgBB

Upload and download images to/from imgBB. Includes nodes for downloading images and a URL βstorageβ node that keeps the original link alongside the workflow.
Setup
Create imgbb_api_key.json under ./loaders/:
{
"api_key": "YOUR_API_KEY_HERE"
}
Obtain a key at https://api.imgbb.com/.
Smart Checkpoint Loader

Drop-in replacement for the core βLoad Checkpoint,β but flattens complex directory trees so checkpoints appear as if in a single folder β ideal for sharing workflows.
Mono Clip

Produces B/W or grayscale clipped images with three modes (each reversible). Useful for masks and stylization.
Based on original code by XSS.
VAE Decode with Preview

VAE decode with inline preview and QoL options.
Based on original code by XSS.
Image to Contrast Mask

Creates a grayscale contrast mask. Select low/high thresholds (1β255), optional blur.
Based on original code by XSS.
PixelArt
![]()
Generates pixel-art style images. Choose interpolation and pixel size.
Based on original Mosaic code by XSS.
Text Mask Overlay

Enhances the idea by Yuigahama Yui:
- Choose fonts from System, User, or local
./fonts/directory. - Built-in Mask-to-Image conversion (no extra converter needed).
Example
| <a href="img/textMaskOverlay01original.png"><img src="img/textMaskOverlay01original.png" alt="Text Mask Overlay Example" width="400"/></a> | <a href="img/textMaskOverlay01.png"><img src="img/textMaskOverlay01.png" alt="Text Mask Overlay Example" width="400"/></a> | | :-: | :-: | | Original | Output |
Example workflow JSON (also embedded in the image below):
Based on the ComfyUI-Text node by Yuigahama Yui.
Image Switchers

Multi-input image switchers (3, 5, 10, 15, 20 inputs). Provide a routing matrix, inline preview, and graceful handling of missing inputs (with user warnings). Designed to avoid βgangedβ switcher confusion in complex workflows.

Random.org True Random Number

Modified version of the WAS node (original wasnβt functioning). Requires a Random.org account and API key.
Based on original code by WASasquatch.
Random.org True Random Number (V2)

Integrates with the random.org JSON-RPC API to generate true random numbers from atmospheric noise.
β¨ Features
-
Secure API key handling
Key is not exposed in UI, workflow JSON, or image metadata. Loaded at runtime from:- Environment variable
RANDOM_ORG_API_KEY, or - Local JSON file
random_org_api_key.jsonnext toRandomOrgV2.py.
- Environment variable
-
Flexible outputs
Emits three types for broad node compatibility:NUMBERFLOATINT
-
Optional uniqueness filtering (in-memory)
Avoid repeats within a Python session:ensure_uniqueβ toggle de-duplicationunique_scopeβ"range"(per[min, max]) or"global"(across all ranges)history_sizeβ how many values to remembertime_window_secβ ignore duplicates older than this windowretry_limitβ extra draws to try before giving up
-
Backwards compatible
Old node remains available asRandomOrgTrueRandomNumber_node.
New node isRandomOrgV2TrueRandomNumber_node.
π API Key Setup
-
Create
random_org_api_key.jsonnext toRandomOrgV2.py:{ "api_key": "YOUR_API_KEY_HERE" } -
Or set an environment variable before launching ComfyUI:
export RANDOM_ORG_API_KEY=YOUR_API_KEY_HEREOn Windows (PowerShell):
setx RANDOM_ORG_API_KEY "YOUR_API_KEY_HERE"
βοΈ Example Usage
-
Generate a random integer between 1 and 100
minimum = 1maximum = 100mode = random
-
Ensure no repeats in the current range
- Enable
ensure_unique - Set
unique_scope = range - Adjust
history_sizeandtime_window_sec
- Enable
π Notes
- Session-lifetime uniqueness resets when Python restarts.
- Persistence (disk-based history) may be added in a future version.
- API limits: Random.org quotas apply β check your dashboard.
Random Image From Directory

This node selects a single image from a given directory (with optional recursion into subdirectories).
It supports true randomness (via Random.org integration if configured) or deterministic selection by index/filename.
It also tracks previously selected images so you can compare βcurrentβ vs βpreviousβ outputs.
β¨ Features
- Directory traversal
- Select only from the top folder, or include all subdirectories.
- Multiple selection modes
random: choose a random image (true random if Random.org is enabled, otherwise local PRNG).by_index: pick image by numeric index (safe wraparound).by_filename: select a file by exact name or substring.by_query: glob-style matching (*.png,cat*, etc.), random among matches.
- Uniqueness filtering
- Avoids repeating the same file within the same session.
- Scope can be per-directory or global.
- Adjustable
history_sizeandtime_window_secfor fine control.
- Metadata outputs
- Current/previous file info, image size, and SHA256 hash of the file.
- Also reports
total_count= number of eligible images found.
π§ Input Parameters
image_directory(string) β Path to the folder containing images.include_subdirs(bool, default: True) β Whether to scan subdirectories.selection_mode(choice, default: random) β Image selection method.index(int) β Used whenselection_mode=by_index.filename_query(string) β Used whenselection_mode=by_filenameorby_query.random_source(choice, default: auto) βauto: use Random.org if API key is configured, else local PRNG.local: always use local PRNG.random_org: force Random.org usage (requires API key).
ensure_unique(bool) β Prevent repeats during a session.unique_scope(choice) β"directory"or"global".history_size(int, default: 512) β Max remembered items.time_window_sec(int, default: 0) β Forget items older than this many seconds.retry_limit(int, default: 16) β Max retries when avoiding duplicates.
π₯οΈ Outputs
imageβ The loaded image tensor.path_currentβ Full path of the selected image (current).index_currentβ Index of the selected image (current).filename_currentβ Filename of the selected image.widthβ Width of the image in pixels.heightβ Height of the image in pixels.sha256β SHA256 checksum of the file (useful for deduplication).total_countβ Total number of eligible images discovered in the directory (after filters).path_previousβ Full path of the image from the previous run.index_previousβ Index of the image from the previous run.
π Random.org Setup (optional)
- To enable true randomness, place your API key in
random_org_api_key.jsonnext to the node:
-
Create
random_org_api_key.jsonnext toRandomOrgV2.py:{ "api_key": "YOUR_API_KEY_HERE" } -
Or set an environment variable before launching ComfyUI:
export RANDOM_ORG_API_KEY=YOUR_API_KEY_HEREOn Windows (PowerShell):
setx RANDOM_ORG_API_KEY "YOUR_API_KEY_HERE"
π Notes
- Current vs previous outputs make it easy to compare selections.
- Session-lifetime uniqueness resets when Python restarts.
- Persistence future versions may add file-based persistence.
- API limits: Random.org quotas apply β check your dashboard.
Examples
Sample Workflow

If the embedded workflow doesn't load, use the JSON:
workflows/ComfyUI_YFG_Comical-Example-Workflow.json
All nodes as of 06-13-2024

Acknowledgements
Huge thanks to creators whose work inspires or integrates with these nodes:
β¦and many others. Thank you for your talent and generosity.
