ComfyUI Extension: ComfyUI-KGnodes
NODES:Custom Resolution Latent Node, Style Selector This Custom node offers various experimental nodes to make it easier to use ComfyUI.
Custom Nodes (4)
README
KGnodes
This Custom node offers various nodes to make it easier to use ComfyUI.
List of the nodes:
Custom Resolution Latent Node: <br>
This node is specifically designed for use with SD 3.5 (of course, you can use it with other models like Flux). Users can select an aspect ratio and a target size of either 1MP or 2MP, and the node will then determine the optimal resolution for compatibility with SD3 models.
Style Selector <br>
This streamlined node leverages the A1111 Prompt Styler. While several nodes offer similar functionality, they typically require a find-and-replace node to parse the A1111 styles file. This node eliminates that requirement. Furthermore, it provides both positive and negative conditioning for enhanced control.<br> In this node, the CLIP input is optional. If you connect the input CLIP, you get conditioning (+/-), and if not, you get only the positive and negative stylized prompt text output.
Image Overlay: RGBA on RGB <br>
This node overlays a foreground image (RGBA or RGB) onto a background image (RGB), preserving transparency and allowing control over the foreground's opacity. The foreground image's alpha channel is used to blend it seamlessly with the background. If the foreground is RGB, an alpha channel is automatically added based on the specified opacity. The output can be either RGB or RGBA, depending on your needs.
Key Features:<br>
- Supports both RGBA and RGB foreground images.
- Adjustable foreground opacity (0.0 to 1.0).
- Outputs in RGB or RGBA format.
- Handles batch processing for multiple images.
Requirements:<br> Both the foreground and background images must be the same size (height and width) for proper compositing. Input tensors should be in the format (B, H, W, C), where: B = Batch size H = Height W = Width C = Channels (3 for RGB, 4 for RGBA)
Text Behind Image <br>
The TextBehindImage node is a specialized tool for creating layered compositions in ComfyUI, designed to place text or graphics between the subject and the background of an image. This node is perfect for scenarios where you want to insert text or design elements behind the main subject while keeping the subject prominently visible on top. <br>
Scale To Side <br>
A ComfyUI custom node that rescales images based on either the longest or shortest side while preserving aspect ratio.
Key Features <br>
- Rescale images by specifying a target size for either the longest or shortest side
- Preserves aspect ratio during rescaling
- Uses optimal rescaling methods:
- Lanczos interpolation for upscaling
- Area interpolation for downscaling
- Flexible usage with optional inputs <br>
Face(s) Detector & Cropper <br>
The Face(s) Detector & Cropper node is a simple and powerful tool for detecting and cropping faces from images in ComfyUI. It processes an input image, identifies faces, and outputs cleanly cropped face images ready for further use.
Features <br>
- Face Detection: Automatically detects faces in an image with adjustable accuracy.
- Customizable Crop Size: Choose from square output resolutions (256x256, 512x512, 768x768, or 1024x1024).
- Zoom Control: Adjust the crop area to include more or less of the surrounding space around the face.
- Sharpening: Enhance face details with customizable sharpening for crisp results.
- Multiple Face Support: Detects and processes multiple faces in a single image.
Use Cases <br>
- IPAdapter (FaceID) or PuLID: Extract a face from an image to use as a reference for face-based generation or editing.
- ReActor Face Swap: Introduce multiple faces as inputs for face-swapping workflows.
This node is perfect for anyone looking to streamline face extraction and enhance their ComfyUI projects with minimal effort.
<br> <br>Installation
Search for KGnodes
in "Comfy Manager" or alternatively:
-
Go to comfyUI custom_nodes folder,
ComfyUI/custom_nodes/
-
Clone the repository
git clone https://github.com/shahkoorosh/ComfyUI-KGnodes.git
-
Install the requirements
pip install -r requirements.txt
-
Restart ComfyUI.
The node resides under Add Node/🎨KG
<br>
<br>
<br>
Acknowledgements
Thanks to twri for SDXL Prompt Styler Node, chibiace for Prompts Node and ControlAltAI for Flux Resolution Calc Node.