ComfyUI Extension: Image Misc
Miscellaneous nodes for image manipulation. Currently just download image with bypass, so you can create workflows including image examples. No extra dependencies, just an internal module.
Custom Nodes (0)
README
ComfyUI Image Miscellaneous Nodes 🎨
This repository provides a set of custom nodes for ComfyUI focused on image manipulation. Currently we just have a few nodes used by other nodes I maintain.
⚙️ Main features
✅ No bizarre extra dependencies, we use the same modules as ComfyUI
✅ Warnings and errors visible in the browser, configurable debug information in the console
📜 Table of Contents
- 🚀 Installation
- 📦 Dependencies
- 🖼️ Examples
- ✨ Nodes
- 📝 Usage Notes
- 📜 Project History
- ⚖️ License
- 🙏 Attributions
✨ Nodes
1. Image Download and Load
- Display Name:
Image Download and Load
- Internal Name:
SET_ImageDownload
- Category:
image/io
- Description: Downloads an image file from a URL into the
ComfyUI/input/
directory if it's not already there, and then loads it as an image and mask. This is perfect for creating self-contained, shareable workflows with example image. - Inputs:
image_bypass
(IMAGE, Optional): If an image is provided here it will be used for the output. You can connect aLoad Image
node here, if the connected node is muted (bypassed) we download the file, otherwise we use the image from theLoad Image
node.mask_bypass
(MASK, Optional): This input complementsimage_bypass
.base_url
(STRING): The URL of the directory containing the image file.filename
(STRING): The name of the image file to download (e.g., photo.jpg, art.png).local_name
(STRING, optional): The name used locally. Leave blank to usefilename
.
- Output:
image
(IMAGE): The loaded image.alpha_mask
(MASK): The alpha mask for the loaded image.
- Behavior Details:
- Caching: The node checks the
ComfyUI/input/
folder first. If the file with the specifiedfilename
already exists, the download is skipped. - Bypass: If only one of
image_bypass
andmask_bypass
is connected the other will be assumed to be empty. You should connect both or avoid using the output corresponding to the unconnected input.
- Caching: The node checks the
2. Face Composite
- Display Name:
Face Composite
- Internal Name:
SET_CompositeFace
- Category:
image/manipulation
- Description: This node is designed for complex batch operations where a single reference image generates multiple animated or processed frames. It handles an M-to-N relationship.
- Purpose: The primary use case is for animation workflows (e.g., using AnimateDiff or SVD) where you:
- Extract a face from one source image.
- Generate N animated frames of that face.
- Paste each of the N animated frames back onto the original source image to create an animated sequence.
- Inputs:
animated
(IMAGE
): A batch ofM*N
cropped/processed images (e.g., the animated faces).reference
(IMAGE
): A batch ofM
original context images that the faces were extracted from.bboxes
(BBOX
): A list ofM
bounding boxes. Each box in the list must correspond to areference
image, defining the location for the paste operation. Format: (X, Y, W, H)
- Output:
images
(IMAGE
): The final output batch ofM*N
full-size images. Each image consists of areference
image with one of theanimated
frames pasted onto it.
- How it Works:
- For each of the
M
reference images and its corresponding bounding box, the node takes the nextN
frames from theanimated
batch. It then pastes each of theseN
frames onto a copy of the reference image, generatingN
final output frames. This process is repeated for allM
reference images. - The animated frame is automatically resized to fit the bounding box dimensions before pasting. The pasting logic safely handles cases where the bbox is partially outside the image boundaries.
- For each of the
3. Face Composite (frame by frame)
- Display Name:
"Face Composite (frame by frame)
- Internal Name:
SET_CompositeFaceFrameByFrame
- Category:
image/manipulation
- Description: This node is a simplified variant for 1-to-1 compositing. It is perfect for video processing workflows where you need to paste a sequence of processed frames back into the original video sequence at a static location.
- Purpose: Ideal for tasks like video face restoration, stylization, or simple lip-sync, where:
- A video is loaded as a sequence of
N
frames. - A corresponding sequence of
N
processed/animated frames is generated. - Each processed frame needs to be pasted back into its corresponding original frame at the same location.
- A video is loaded as a sequence of
- Inputs:
animated
(IMAGE
): A batch ofN
processed frames.reference
(IMAGE
): A batch ofN
original frames. Must have the same batch size asanimated
.bboxes
(BBOX
): A list of bounding boxes. Only the first bbox in the list is used as the static paste location for all frames.
- Output:
images
(IMAGE
): The final batch ofN
composited frames.
- How it Works: The node iterates from frame 0 to N-1. In each step, it takes the i-th
animated
frame and the i-threference
frame. It then pastes the animated frame onto the reference frame using the coordinates from the single, static bounding box.
4. Normalize Image to ImageNet
- Display Name:
"Normalize Image to ImageNet
- Internal Name:
SET_NormalizeToImageNetDataset
- Category:
image/normalization
- Description: Normalizes an image tensor using the mean and standard deviation of the ImageNet dataset.
- Purpose: Essential for pre-processing images before feeding them into models that were pre-trained on ImageNet (e.g., most ResNet, VGG, EfficientNet models).
- Inputs:
image
(IMAGE
): A standard ComfyUI image tensor in the[0, 1]
range.
- Output:
image
(IMAGE
): The normalized image tensor. The value range will be altered significantly.
- How it Works: For each channel, it performs the operation
output = (input - mean) / std
, using the standard ImageNet values: - Mean:[0.485, 0.456, 0.406]
- Std Dev:[0.229, 0.224, 0.225]
5. Normalize Image to [-0.5, 0.5]
- Display Name:
Normalize Image to [-0.5, 0.5]
- Internal Name:
SET_NormalizeToMinus05_05
- Category:
image/normalization
- Description: Normalizes an image tensor by centering its values around zero.
- Purpose: Useful for models trained from scratch or those that expect input data in the
[-0.5, 0.5]
range. This can help stabilize training. - Inputs:
image
(IMAGE
): A standard ComfyUI image tensor in the[0, 1]
range.
- Output:
image
(IMAGE
): The normalized image tensor, with values in the[-0.5, 0.5]
range.
- How it Works: For each channel, it performs the operation
output = (input - mean) / std
, using:- Mean:
[0.5, 0.5, 0.5]
- Std Dev:
[1.0, 1.0, 1.0]
- Mean:
6. Normalize Image to [-1, 1]
- Display Name:
Normalize Image to [-1, 1]
- Internal Name:
SET_NormalizeToMinus1_1
- Category:
image/normalization
- Description: Normalizes an image tensor to the
[-1, 1]
range. - Purpose: A common requirement for certain model architectures, particularly Generative Adversarial Networks (GANs) and models using the
tanh
activation function in their output layer. - Inputs:
image
(IMAGE
): A standard ComfyUI image tensor in the[0, 1]
range.
- Output:
image
(IMAGE
): The normalized image tensor, with values in the[-1, 1]
range.
- How it Works: For each channel, it performs the operation
output = (input - mean) / std
, using:- Mean:
[0.5, 0.5, 0.5]
- Std Dev:
[0.5, 0.5, 0.5]
- Mean:
7. Apply Mask using AFFCE
- Display Name:
Apply Mask using AFFCE
- Internal Name:
SET_ApplyMaskAFFCE
- Category: `image/manipulation
- Description: Applies a mask to an image using Approximate Fast Foreground Colour Estimation. This blends the image contour in a better way.
- Purpose: Used to apply the mask of a background removal model.
- Inputs:
images
(IMAGE
): One ore more ComfyUI imagesmasks
(MASK
): Masks to applyblur_size
(INT
): Diameter for the coarse gaussian blurblur_size_two
(INT
): Diameter for the fine gaussian blurfill_color
(BOOLEAN
): When enabled the removed image is replaced by a color, the output is an RGB image. Otherwise the removed part becomes transparent and the output is an RGBA image.color
(STRING
): A string representing a color to be used whenfill_color
is enabled. Can be an hexadecimal RGB (i.e.#AABBCC
) or comma separated RGB components. The components can be in the [0-255] or [0-1.0] range.batched
(BOOLEAN
): Process all the images at once. Otherwise do it one at a time.
- Output:
image
(IMAGE
): The image after applying the mask.mask
(MASK
): The input mask
🚀 Installation
You can install the nodes from the ComfyUI nodes manager, the name is Image Misc, or just do it manually:
- Clone this repository into your
ComfyUI/custom_nodes/
directory:cd ComfyUI/custom_nodes/ git clone https://github.com/set-soft/ComfyUI-ImageMisc ComfyUI-ImageMisc
- Install dependencies:
pip install -r ComfyUI/custom_nodes/ComfyUI-ImageMisc/requirements.txt
- Restart ComfyUI.
The nodes should then appear under the "image/io" category in the "Add Node" menu.
📦 Dependencies
- SeCoNoHe (seconohe): This is just some functionality I wrote shared by my nodes, only depends on ComfyUI.
- PyTorch: Installed by ComfyUI
- NumPy: Installed by ComfyUI
- Pillow: Installed by ComfyUI
- Requests (optional): Usually an indirect ComfyUI dependency. If installed it will be used for downloads, it should be more robust than then built-in
urllib
, used as fallback. - Colorama (optional): Might help to get colored log messages on some terminals. We use ANSI escape sequences when it isn't installed.
🖼️ Examples
Once installed the examples are available in the ComfyUI workflow templates, in the Image Misc section (or ComfyUI-ImageMisc).
- image_download.json: Shows how to use the image downloader node.
📝 Usage Notes
- Logging: 🔊 The nodes use Python's
logging
module. Debug messages can be helpful for understanding the transformations being applied. You can control log verbosity through ComfyUI's startup arguments (e.g.,--preview-method auto --verbose DEBUG
for more detailed ComfyUI logs which might also affect custom node loggers if they are configured to inherit levels). The logger name used is "ImageMisc". You can force debugging level for these nodes defining theIMAGEMISC_NODES_DEBUG
environment variable to1
.
📜 Project History
- 1.0.0 2025-07-21: Initial release
- Just the download image.
⚖️ License
🙏 Attributions
- Good part of the initial code and this README was generated using Gemini 2.5 Pro.