ComfyUI Extension

Image and mask compositing utilities for ComfyUI: background removal, sprite sheets, strip masks, shape masks, cube grids, and image offsetting

By nerdywhiskers·Created 5 months ago·Updated 2 days ago· 1
nerdywhiskers/ComfyUI-Whisker-Nodes
Nodes7
On cloudLocal install
Categorywhisker-nodes
Stars1
Updated2 days ago
Readme

Whisker Nodes for ComfyUI

A pack of image and mask compositing utilities for ComfyUI. All nodes appear under Add Node → whisker-nodes.

Installation

Portable ComfyUI (Windows)

From the root of ComfyUI_windows_portable:

cd ComfyUI\custom_nodes
git clone https://github.com/nerdywhiskers/ComfyUI-Whisker-Nodes.git
cd ..\..
python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-Whisker-Nodes\requirements.txt

Then restart ComfyUI.

System Python

cd ComfyUI/custom_nodes
git clone https://github.com/nerdywhiskers/ComfyUI-Whisker-Nodes.git
pip install -r ComfyUI-Whisker-Nodes/requirements.txt

Updating

cd ComfyUI/custom_nodes/ComfyUI-Whisker-Nodes
git pull

Restart ComfyUI after pulling.

Nodes

Whisker: BG Remove + Compose

<img width="1625" height="609" alt="image" src="https://github.com/user-attachments/assets/c6f246a8-8f5f-4fe2-b64f-6fc8176f062f" />

Removes the background of an input image with BiRefNet (MIT) or RMBG-2.0 (BRIA, non-commercial) and composes the asset onto a canvas at user-specified dimensions.

  • background: alpha (transparent canvas) or color (solid bg_color canvas, alpha-blended).
  • position: nine canvas anchors (top-leftbottom-right) within the padded destination area.
  • resize_to_fit: when ON, the cropped asset scales proportionally to fit the destination area without clipping.
  • scale: multiplier on the cropped asset when resize_to_fit is OFF; oversized results are reduced proportionally to fit.
  • padding_top/bottom/left/right: destination-canvas margins used for fitting and anchor placement.
  • crop_padding: source pixels retained around the predicted foreground bounds before resizing (default 20).
  • Output: 4-channel RGBA IMAGE + MASK.

The model is moved to GPU only during inference and back to CPU between calls (via comfy.model_management), so it can share VRAM with diffusion models.

Whisker: Sprite Sheet Generator

<img width="2092" height="1020" alt="image" src="https://github.com/user-attachments/assets/15ea0dea-103a-43b3-b70c-6a6a1363331a" />

Concatenates frames from an IMAGE batch (e.g. from VideoHelperSuite's "Load Video" or stock animated-WebP loader) into a single sprite sheet.

  • target_frame_count: prune by step-skipping every total // target frames.
  • start_index / end_index: applied to the pruned set; -1 = last.
  • grid_cols × grid_rows: explicit grid layout.
  • target_resolution: longest side of the final sheet (frames are resized first, so memory tracks the output size).
  • bg_removal: none, per-frame (BiRefNet/RMBG on each frame), or whole-sheet (single pass on the assembled sheet).
  • padding_top/bottom/left/right + position: only effective with per-frame bg removal (or none with RGBA input) — each frame's asset is bbox-cropped and anchored within (cell − paddings).
  • crop_padding / fit_to_canvas / original_image_scale: same crop → scale → anchor pipeline as BG Remove + Compose, applied per sprite cell (defaults preserve the legacy tight-crop, never-upscale behavior).
  • batch_size: frames per bg-removal forward pass (default 4). Only one chunk is on GPU at a time; lower to 12 on small GPUs, OOMs auto-retry in halves.
  • Output: 4-channel RGBA IMAGE + MASK.

Whisker: Shape Mask

<img width="1423" height="908" alt="image" src="https://github.com/user-attachments/assets/ef2a3076-443c-4fe7-9451-5c09cd85dcf2" />

Generates a white shape of explicit pixel size on a colored canvas, edge-anchored so it always stays within the canvas bounds.

  • canvas width / canvas height: canvas size in pixels.
  • x / y: shape width/height in pixels (clamped to the canvas).
  • position: 9-grid edge anchor (e.g. bottom-center sits flush on the bottom edge).
  • bg_color: hex string (default #000000 for the classic white-on-black look).
  • corner_radius: 0–100 slider, percent of the maximum rounding (half the shorter side). 100 draws an inscribed ellipse — a circle when x equals y.
  • blur: Gaussian blur applied to the mask; the IMAGE is derived by alpha-blending white over bg_color through the mask, so soft edges show consistently in both outputs.
  • Output: 3-channel IMAGE + MASK.

Whisker: Strip Mask Generator

<img width="1719" height="859" alt="image" src="https://github.com/user-attachments/assets/eb8adc42-9ab9-471f-8923-7d6bc3275cf6" />

Generates 2–8 strip masks that tile a container without gaps or overlap.

  • num_masks: 2–8.
  • orientation: horizontal (full-width bands) or vertical (full-height bands).
  • primary_mask_size + primary_mask_index: one strip's pixel size is user-set; the others split the remainder evenly with the rounding remainder distributed per-pixel so the strips exactly fill the container.
  • noise_amount / noise_scale: smooth 1D noise displaces the interior boundaries. All boundaries share the same noise vector, so the strip stack warps coherently.
  • blur: Gaussian blur on each output mask.
  • Output: 8 fixed MASK outputs (mask_1mask_8); slots beyond num_masks are zero masks.

Whisker: Random Cube Grid Generator

<img width="1741" height="876" alt="image" src="https://github.com/user-attachments/assets/029cf5e9-2933-49e5-b2d9-84b834d68ed8" />

Procedurally places white squares on a black grid with control over density, gaps, sizing, and per-edge column rules. Outputs the image plus a JSON list of {x, y, size} cube coordinates for downstream use (the JSON pairs naturally with the Block Grid Generator-style nodes you might build on top of it).

Whisker: Offset Image

<img width="2329" height="785" alt="image" src="https://github.com/user-attachments/assets/cfef588e-e00a-4d86-8683-a4add3160032" />

Wraps an image by offset_x / offset_y pixels via torch.roll (true tile-style shift) and emits a seam mask centered on the actual wrap line, with adjustable thickness and Gaussian blur — handy for inpainting seams to make seamless tiles.

Models

The BG removal models download to your HuggingFace cache on first use (~/.cache/huggingface/hub/):

  • BiRefNet (ZhengPeng7/BiRefNet) — MIT license, ~880 MB. Default. Good edge quality on hair, fur, fine details.
  • RMBG-2.0 (briaai/RMBG-2.0) — BRIA license, non-commercial without a paid license, ~885 MB.

If you intend to use the BG removal nodes commercially, stick with BiRefNet.

License

See LICENSE.