Extensions/zhangp365/ComfyUI-utils-nodes
ComfyUI Extension

zhangp365/ComfyUI-utils-nodes

Nodes:LoadImageWithSwitch, ImageBatchOneOrMore, GenderControlOutput, ImageCompositeMaskedWithSwitch, ImageCompositeMaskedOneByOne, ColorCorrectOfUtils, SplitMask,…

By zhangp365·Created 2 years ago·Updated 5 months ago· 134
zhangp365/ComfyUI-utils-nodes
Nodes62
On cloudLocal install
Categoryutils/numbers, utils/text
Stars134
Updated5 months ago

Nodes (62)

Aspect Ratio Size Selector

Pick a ratio and a size tier instead of typing pixels

utils/numbers
Boolean Control Output

Boolean Control Output

utils/text
Load Checkpoint with Switch

Skip loading the parts of a checkpoint you don't need

utils/loaders
Color Correct of Utils

One node for temperature, per-channel push, and grain

Art Venture/Post Processing
Concat Text

Joining prompt fragments without one giant text box

utils/text
CropByMaskToSpecificSize

CropByMaskToSpecificSize

utils/mask
Deepface Analyze Face Attributes

Gender, age, race, and emotion detection in ComfyUI

utils/face
detector for the NSFW

An in-graph NudeNet content filter for ComfyUI

utils/filter
Empty Conditioning

A real no-op CONDITIONING socket for ComfyUI

utils/conditioning
FAL Fun Control Video Request

FAL Fun Control Video Request

utils/video
FAL Image2Video Request

FAL Image2Video Request

utils/video
FAL Nano Banana

FAL Nano Banana

utils/image
FAL Video2Video Request

FAL Video2Video Request

utils/video
Float Multiple and Add Literal

Float Multiple and Add Literal

utils/numbers
Frame Adjuster

Frame Adjuster

utils
Gemini prompt enhance

Gemini Prompt Enhance

utils/text
Gender Control Output

Gender Control Output

utils/text
Image Auto Selector

Pick the best available image out of up to three candidates

utils/image
Batch Images One or More

ComfyUI's ImageBatch, but it doesn't need exactly two

utils/image
image composite masked one bye one

Compositing video batches without blowing your VRAM

utils/image
Image Composite Masked

A compositor you can flip off without rewiring

utils/image
Image Composite Masked

Image Composite Watermark

image/compositing
Image Concatenate of Utils

Gluing up to six images into one, without crashing on empty slots

utils/image
Image Mask Color Average

Image Mask Color Average

utils/image
Image Resize to 8x

Resizing that never breaks your composite-back step

utils/image
ImageScaleToTotalPixelsSwitch

ImageScaleToTotalPixelsSwitch

utils/switch
Images Concanate To Grid

Turn a batch of images into one contact sheet

utils/image
Image Transition

A crossfade between two images, as a frame batch

utils/image
Image Transition Bottom to Top

A rising slide-wipe between two images

utils
Image Transition Left to Right

A slide-wipe transition, not a crossfade

utils
Image Transition Right to Left

Image Transition Right to Left

utils
Image Transition Top to Bottom

A vertical slide-wipe between two images

utils
Int Multiple and Add Literal

Do ax + b math inline instead of wiring up a math node

utils/numbers
Load Image as Mask without Listing Input Dir

The mask loader for when your input folder has thousands of files

utils/mask
Load Image as Mask with Switch

A mask loader you can toggle off in place

utils/mask
Load Image without Listing Input Dir

Load Image without Listing Input Dir

utils/image
Load Image with Switch

An image loader you can disable without disconnecting it

utils/image
Mask Area Comparison

Gate your workflow on whether a mask is actually big enough to matter

mask/utils
Mask Auto Selector

Pick whichever mask actually got wired in, in priority order

utils/mask
Mask Cover Four Corners

Generate a corner mask, built for stripping watermarks

utils/mask
Mask Grow Fast

Mask dilation that doesn't slow to a crawl at high grow values

utils/mask
Mask from FaceModel

Turn a Reactor face model into a mask of the lower face

utils/mask
Mask of Center

Mask the middle of the frame so a model focuses there

utils/mask
Match Image Ratio to Standard Size

Snap an odd-aspect image to the nearest SDXL training bucket

utils/image
Models Downloader

Models Downloader

utils/download
Modify Text Gender

Rewriting a description toward male or female automatically

utils/text
get Image Size And Count by utils

Get Image Size And Count by Utils

utils/image
Novita Video Request

Image-to-video via Novita's API, running Wan 2.2 under the hood

utils/video
FAL Qwen Edit Plus LoRA

Qwen-Image-Edit with LoRAs, run on FAL instead of your own GPU

utils/image
ReferenceLatentSwitch

A/B test a reference-image edit without rewiring your graph

utils/switch
Replicate Image Request

Calling Replicate's hosted Flux Dev from inside ComfyUI

utils/image
Replicate Video Request

Replicate Video Request

utils/video
Segmind Video Request

Cloud image-to-video through Segmind's Wan 2.2 Fast endpoint

utils/video
Split Mask by Contours

Split Mask by Contours

utils/mask
Text Input Auto Selector

A safe fallback for text that might come in blank

utils/text
Preview Text

See what a string actually contains before it hits your next node

utils/text
Torch Compile Model Advanced

Torch.compile for ComfyUI with a real off switch

utils
Upscale Image (using Model)

Skip the upscale pass when the image is already big enough

image/upscaling
VAE Encoder (Switch)

VAE Encoder (Switch)

utils/switch
volcano ark image edit

Image editing via ByteDance's Volcano Ark API

image/ark
volcano image edit

Text-prompt image edits via ByteDance's SeedEdit API

image/volcano
volcano outpainting

Mask-based canvas extension via ByteDance's Volcano API

image/volcano
Readme

Some Utils for ComfyUI

Notice: The face detection node depends on TensorFlow 2.17, which is now outdated and may cause compatibility issues. Therefore, it is no longer installed by default. If you need to use this node, please install it manually. Users who have previously installed this library are not affected.

LoadImageWithSwitch

Modified the official LoadImage node by adding a switch. When turned off, it will not load the image.

LoadImageMaskWithSwitch

Modified the official LoadImageMask node by adding a switch. When turned off, it will not load the image to mask.

LoadImageWithoutListDir

When there are a lot of images in the input directory, loading image with os.listdir can be slow. This node avoids using os.listdir to improve performance.

LoadImageMaskWithoutListDir

When there are a lot of images in the input directory, loading image as Mask with os.listdir can be slow. This node avoids using os.listdir to improve performance.

ImageCompositeMaskedWithSwitch

Modified the official ImageCompositeMasked node by adding a switch. When turned off, it will return the destination image directly.

ImageCompositeMaskedOneByOne

Modified the official ImageCompositeMasked node to process images one by one, instead of processing an entire batch at once. In video scenarios, processing in a batch may require a significant amount of memory, but this method helps reduce memory usage.

ImageBatchOneOrMore

This node can input one or more images, the limit is six. It expands the functionality of the official ImageBatch node from two to multiple images.

ImageConcatenateOfUtils

This node, ImageConcatenateOfUtils, is an extension of the original ImageConcatenate node developed by @kijai.

Features

  • Upscale: This extension adds the capability to upscale images.
  • Check: Additional functionality for checking the second image empty or not.

Original node

The original ImageConcatenate node can be found here. Special thanks to @kijai for their contribution to the initial version.

ColorCorrectOfUtils

This node, ColorCorrectOfUtils, is an extension of the original ColorCorrect node developed by @EllangoK. Added the channels of red, green, and blue adjustment functionalities.

ImagesConcanateToGrid

This node is designed to concatenate the input one batch images to a grid. It can concatenate images in the horizontal or vertical direction.

VolcanoOutpainting

This node is designed to outpaint the input image using the Volcano engine. To use this node, you must get your free API key from Volcano engine:

  • Visit Volcano engine
  • Log in with your Volcano engine account
  • Click on "访问控制" or go to settings
  • Create a new API key
  • Copy the API key for use in the node's input

VolcanoImageEdit

This node is designed to edit the input image using the Volcano engine.

VolcanoArkImageEdit

This node is designed to edit images using the volcano Ark API, supporting multiple input images and various image sizes and aspect ratios.

ModifyTextGender

This node adjusts the text to describe the gender based on the input. If the gender input is 'M', the text will be adjusted to describe as male; if the gender input is 'F', it will be adjusted to describe as female.

GeminiPromptEnhance

This node is designed to enhance the text description of the image, using the latest Gemini 2.0 flash model. It can add quality descriptors, lighting descriptions, scene descriptions, and skin descriptions to the text. and according to the gender input, can modify the content about gender.

To use this node, you must get your free API key from Google AI Studio:

  • Visit Google AI Studio
  • Log in with your Google account
  • Click on "Get API key" or go to settings
  • Create a new API key
  • Copy the API key for use in the node's input or gemini_config.json

this code is original from https://github.com/ShmuelRonen/ComfyUI-Gemini_Flash_2.0_Exp, added new features. thanks to @ShmuelRonen.

GenderControlOutput

This node determines the output based on the input gender. If the gender input is 'M', it will output male-specific text, float, and integer values. If the gender input is 'F', it will output female-specific text, float, and integer values.

BooleanControlOutput

This node outputs different values based on a boolean input. If the boolean input is True, it will output the values of true_text, true_float, true_int, True, and False. If the boolean input is False, it will output the values of false_text, false_float, false_int, False, and True.

SplitMask

This node splits one mask into two masks of the same size according to the area of the submasks. If there are more than two areas, it will select the two largest submasks.

MaskFastGrow

This node is designed for growing masks quickly. When using the official or other mask growth nodes, the speed slows down significantly with large grow values, such as above 20. In contrast, this node maintains consistent speed regardless of the grow value.

MaskFromFaceModel

Generates a mask from the face model of the Reactor face swap node. The mask covers the facial area below the eyes, excluding the forehead. Enabling add_bbox_upper_points provides a rough approximation but lacks precision. If the forehead is essential for your application, consider using a different mask or adjusting the generated mask as needed.

<img src="assets/maskFromFacemodel.png" width="100%"/>

MaskAutoSelector

Check the three input masks. If any are available, return the first. If none are available, raise an exception.

MaskCoverFourCorners

Generates a mask by covering the selected corners with circular edges. This mask can be used as an attention mask to remove watermarks from the corners.

MaskofCenter

Generates a mask by covering the center of the image with a circular edge. This mask can be used as an attention mask, then model can focus on the center of the image.

MaskAreaComparison

This node compares the area of the mask with the threshold. If the area is greater than the threshold, it will return True; otherwise, it will return False.

CheckpointLoaderSimpleWithSwitch

Enhanced the official LoadCheckpoint node by integrating three switches. Each switch controls whether a specific component is loaded. When a switch is turned off, the corresponding component will not be loaded. if you use the extra vae and close the model's vae loading, that will save memory.

ImageResizeTo8x

Modified the image-resize-comfyui image resize node by adding logic to crop the resulting image size to 8 times size, similar to the VAE encode node. This avoids pixel differences when pasting back by the ImageCompositeMasked node.

ImageAutoSelector

This node is designed to automatically select the image from the input. If the prior image is not empty, return the prior image; otherwise, return the alternative image or the third image.

TextPreview

Added the node for convenience. The code is originally from ComfyUI-Custom-Scripts, thanks.

TextInputAutoSelector

Check the component and alternative input. If the component input is not empty, return this text; otherwise, return the alternative text.

MatchImageRatioToPreset

According to the input image ratio, decide which standard SDXL training size is the closest match. This is useful for subsequent image resizing and other processes.

AspectRatioSizeNodeOfUtils

Select aspect ratio (1:1, 9:16, 16:9, 3:4, etc.) and size preset (1k, 2k, 4k) to output corresponding width and height values. Supports "auto" mode to pass through input dimensions directly. Includes divisibility option (none/8/16) to ensure output values are aligned, and batch_size pass-through.

UpscaleImageWithModelIfNeed

Enhanced the official UpscaleImageWithModel node by adding a judge. If the input image area exceeds a predefined threshold, upscaling is bypassed. The threshold is a percentage of the SDXL standard size (1024x1024) area.

ImageCompositeWatermark

This node is designed to composite a watermark into the destination image. It can select the position of the watermark, resize the watermark according to the input ratio, and add a margin to the watermark.

ImageTransition

This node is designed to generate a transition image between two images. The first image gradually fades out while the second image simultaneously appears, creating a smooth transition effect.

ImageTransitionLeftToRight

This node is designed to generate a transition image between two images. The first image gradually slides to the right while the second image simultaneously appears from the left, creating a smooth transition effect.

ImageTransitionRightToLeft

This node is designed to generate a transition image between two images. The first image gradually slides to the left while the second image simultaneously appears from the right, creating a smooth transition effect.

ImageTransitionTopToBottom

This node is designed to generate a transition image between two images. The first image gradually slides down while the second image simultaneously appears from the top, creating a smooth vertical transition effect.

ImageTransitionBottomToTop

This node is designed to generate a transition image between two images. The first image gradually slides up while the second image simultaneously appears from the bottom, creating a smooth vertical transition effect.

ImageMaskColorAverage

This node is designed to calculate the average color of the image within the mask. It returns the decimal and hexadecimal values of the average color.

TorchCompileModelAdvancedOfUtils

This node enables model compilation using torch.compile. It extends ComfyUI's original torch compile node by adding compile mode options and a toggle switch.

DetectorForNSFW

This node adapts the original model and inference code from nudenet for use with Comfy. A small 10MB default model, 320n.onnx, is provided. If you wish to use other models from that repository, download the ONNX model and place it in the models/nsfw directory, then set the appropriate detect_size.

From initial testing, the filtering effect is better than classifier models such as Falconsai/nsfw_image_detection.

<img src="assets/detectorForNSFW.png" width="100%"/> You can also adjust the confidence levels for various rules such as buttocks_exposed to be more lenient or strict. Lower confidence levels will filter out more potential NSFW images. Setting the value to 1 will stop filtering for that specific feature.

output

The output_image includes the original image and the alternative image or the blank image. detect_result is the result of the detection with json format. filtered_image only includes the image after filtering, if it is just one image and nsfw, it raises an exception in the save_image node.

DeepfaceAnalyzeFaceAttributes

Notice: The face detection node depends on TensorFlow 2.17, which is now outdated and may cause compatibility issues. Therefore, it is no longer installed by default. If you need to use this node, please refer to requirements.txt to install the dependencies manually. Users who have previously installed this library are not affected.

This node integrates the deepface library to analyze face attributes (gender, race, emotion, age). It analyzes only the largest face in the image and supports processing one image at a time. <img src="assets/deepfaceAnalyzeFaceAttributes.png" width="100%"/>

If the input image is a standard square face image, you can enable the standard_single_face_image switch. In this case, the node will skip face detection and analyze the attributes directly.

Upon the first run, the node will download the deepface models, which may take some time.

Note: If you encounter the following exception while running the node:

ValueError: The layer sequential has never been called and thus has no defined input.

Please set the environment variable TF_USE_LEGACY_KERAS to 1, then restart ComfyUI.

Caution: If you are not using this node, please remove the dependencies in requirements.txt. Otherwise, it will install TensorFlow version 2.17.x.

EmptyConditioning

This node is designed to return an empty conditioning, the size is zero. It can be used to replace the conditioning when the conditioning is not actually needed.

CropByMaskToSpecificSize

This node is designed to crop the image by the mask to a specific size.

ReplicateRequstNode

This node is designed to generate images using Replicate's model API. It supports various aspect ratios, LoRA weights, and provides flexible error handling options.

ReplicateVideoRequestNode

This node is designed to generate videos using Replicate's model API, with Wan2.2 as the default video model.

NovitaVideoRequestNode

This node is designed to generate videos using Novita's API. It supports image-to-video generation with various resolution options and duration settings.

FalImage2VideoRequestNode

This node is designed to generate videos from images using FAL's API. It provides high-quality video generation with various customization options. To use this node, you need to get your FAL API key:

  • Visit fal.ai
  • Log in with your account
  • Go to API keys settings
  • Create a new API key
  • Copy the API key for use in the node's input or fal_config.yml

FalVideo2VideoRequestNode

This node is designed to use the fal-ai/wan-22-vace-fun-a14b/pose model. When you input a pose video and an image, it will generate an action video based on the pose sequence.

FalFunControlVideoRequestNode

This node is designed to use the fal-ai/wan-fun-control model. It can input pose or depth videos along with a reference frame, then generate the resulting video based on the control input.

QwenEditPlusLoraNode

This node is designed to edit images using FAL's qwen-image-edit-plus-lora model. It supports uploading multiple images (first image is required, up to 3 additional images are optional) and applying up to 3 LoRAs with custom weights. The node automatically handles image uploads to FAL and returns the edited image with dimensions.

FalNanoBananaNode

This node is designed to edit images using FAL's nano-banana models. It supports two models: fal-ai/nano-banana/edit and fal-ai/nano-banana-pro/edit. The node supports uploading up to 4 images or providing image URLs, and can generate multiple images with various aspect ratios, resolutions, and output formats.

SegmindVideoRequestNode

This node is designed to generate videos from an image using Segmind's API. The default model is the wan-2.2-i2v-fast. The image must be a url. It supports fast video generation with various resolution and aspect ratio options.

ModelsDownloaderOfUtils

This node downloads models or LoRAs to a subdirectory. If the model already exists, it simply returns the model name in the corresponding location.

ImageScaleToTotalPixelsSwitch

Modified the official ImageScaleToTotalPixels node by adding a switch. When turned off, it will return the input image directly.

ReferenceLatentSwitch

Modified the official ReferenceLatent node by adding a switch. When turned off, it will return the input conditioning directly.

VAEEncoderSwitch

Modified the official VAEEncoder node by adding a switch. When turned off, it will return None.