ComfyUI Node

BMAB Edge

Canny-style edge detection, blended back into the image

By portu-sim·Created 2 years ago·Updated 8 months ago· 124
BMAB Edge
  • pixels
  • image
threshold150
threshold2200
strength0.50

If the two threshold inputs on this node look familiar, that's not a coincidence - threshold1 and threshold2 are the exact pair of parameters behind the classic Canny edge detector, the same algorithm that powers Canny preprocessing everywhere from OpenCV to ControlNet's own edge conditioning node.

What it is and why you'd reach for it

BMAB Edge runs Canny-style edge detection on an image and blends the result back into the original at a controllable strength, rather than replacing the image outright with a pure black-and-white edge map. That strength control is what separates this from a plain edge-detection node: instead of getting a stark line drawing, you get an edge-emphasized version of your original image, with the amount of emphasis dialed in by you.

That makes it more of an edge-enhance or sharpen-adjacent effect node than a ControlNet-preprocessing node in the strict sense - if you specifically need a clean Canny map to feed into BMAB ControlNet or another ControlNet loader, you'd typically reach for a dedicated Canny preprocessor instead (comfyui_controlnet_aux ships one). This node is closer to a stylistic or detail-emphasis pass you'd apply directly to a finished or near-finished image.

How it works

Canny edge detection works off two thresholds, which is exactly what threshold1 and threshold2 control: pixels with a gradient above the higher threshold are confidently marked as edges, pixels below the lower threshold are confidently marked as not-edges, and pixels in between are only kept if they connect to a confirmed edge. Higher thresholds mean fewer, more confident edges detected; lower thresholds catch more detail but also more noise. Once the edge map is computed, strength decides how much of that edge information gets blended back into the original image - low strength gives a subtle sharpening effect, high strength pushes toward a much more graphic, line-heavy look.

Inputs and outputs

  • pixels (required, IMAGE) - the image to detect edges in.
  • threshold1 (default 50, range 1–255) - the lower Canny threshold.
  • threshold2 (default 200, range 1–255) - the upper Canny threshold. The wide gap between the two defaults (50 vs 200) is standard Canny practice - a roughly 1:3 to 1:4 ratio between the two is the usual starting point before you tune further.
  • strength (default 0.5, range 0–1) - how much of the detected edges gets blended back into the original image.

Output: a single image, with edges blended in at the strength you specified.

Installing it

Through ComfyUI Manager: search comfyui_bmab, install, restart. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/portu-sim/comfyui_bmab.git
cd comfyui_bmab
pip install -r requirements.txt

(Windows portable users: python_embeded\python.exe -m pip install -r requirements.txt.) This is a classic CPU-side image-processing node - no model weights, no GPU dependency, and nothing tying it to BMAB's optional comfyui_controlnet_aux or ComfyUI_IPAdapter_plus companion packs.

Common issues

  • Thresholds too close together, producing noisy or overly sparse edges. If your edge detection looks either far too busy or barely present, widen or narrow the gap between threshold1 and threshold2 rather than moving them in lockstep - the ratio between the two matters as much as their absolute values.
  • Expecting a clean edge map for ControlNet and getting a blended photo instead. That's this node's whole design - it blends edges into the original rather than outputting a pure edge map. If you need a stark line-art-style condition image, look for a dedicated Canny preprocessor (comfyui_controlnet_aux has one) instead of this node.
  • Strength set too high for a subtle effect, or too low for a strong one. It's a straightforward linear dial - if the effect is barely visible, raise strength; if it's overpowering the image, lower it.
CategoryBMAB/basic

Inputs (4)

NameTypeDefaultDescription
pixelsIMAGE
threshold1FLOAT501–255
threshold2FLOAT2001–255
strengthFLOAT0.500–1

Outputs (1)

NameTypeDescription
imageIMAGE