Nodes/ComfyUI-Nikosis-Preprocessors/Edge Preprocessor (nikosis)
ComfyUI Node

Edge Preprocessor (nikosis)

Five edge detectors in one node, and the default is the one you didn't know you wanted

By Nikosis·Created about a year ago·Updated about a year ago· 2
Edge Preprocessor (nikosis)
  • image
  • IMAGE
modelpyracanny
low_threshold100
high_threshold200
resolution512
keep_proportiontrue

Canny edge maps are the oldest trick in the ControlNet book - thin, clean outlines that tell the model where your architecture, machinery, or composition boundaries are. This node packs five different edge detectors into one box: canny, laplacian, prewitt, sobel, and pyracanny, which happens to be the default. And here's the nice part: it's all OpenCV. No weights, no model downloads, no first-run fetch. Install the pack once and it just works, even offline.

What each "model" actually is

The model input is an algorithm selector, not a neural net - don't expect a download. Your choices:

  • pyracanny (default) - pyramid Canny. It runs the Canny detector at nine scales from 0.2x to 1.0x and accumulates the results. That's a lot of compute, but the point is real: this is the preprocessor SAI trained Control-Lora Canny on, and it's far more forgiving about weird input resolutions than plain Canny. If you use the Control-Lora Canny model, this is the map it expects.
  • canny - the classic cv2.Canny, thin hard edges. The safe, standard choice for regular Canny ControlNets.
  • sobel / prewitt - gradient-magnitude detectors; sobel uses the standard 3x3 kernel, prewitt a slightly softer one. Both get thresholded the same way. Fine when you want stronger, chunkier edges than Canny gives.
  • laplacian - second-derivative edge detection. Doubles up on both sides of an edge; better for blur/focus work than for clean ControlNet conditioning. (This pack also ships it as its own standalone node.)

Inputs that matter

  • image - your input.
  • low_threshold / high_threshold (default 100/200, range 0–255) - the two knobs you'll actually tune. Pixels above the high threshold become strong edges; pixels between low and high become weak ones. Both up to kill noise, both down to catch faint detail. Canny purists know this as the classic double-threshold pair.
  • resolution (default 512, 64–2048, step 16) - the target for the shorter side of the image.
  • keep_proportion (default on) - on, it keeps aspect ratio and crops the leftover to a multiple of 16 (symmetric crop); off, it stretches slightly to hit a clean dimension. Leave it on unless you need exact output sizes.

Output is a single IMAGE: white edges on black, 3-channel, ready to plug into a Canny/edge ControlNet or Control-Lora.

Installing it

This node lives in the ComfyUI-Nikosis-Preprocessors pack from Nikosis (the same author as the ComfyUI-Nikosis-Nodes prompt pack that gets recommended on r/comfyui - a real author, just not a household name).

  • ComfyUI Manager: search ComfyUI-Nikosis-Preprocessors → Install → restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/Nikosis/ComfyUI-Nikosis-Preprocessors comfyui-nikosis-preprocessors, then pip install -r requirements.txt (Windows portable uses ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt), restart.

The one dependency that actually matters here is opencv-python - that's the whole engine of this node. It's in requirements.txt, so a clean install gets it. If you see an import error for cv2, that's the thing to install.

Gotchas

  • PyraCanny is slower than plain Canny by design (nine passes). On a big batch, that adds up - switch to plain canny for a quick preview pass.
  • Thresholds behave the same across all five detectors, but the "look" differs wildly: don't tune pyracanny, then swap to sobel and expect the same map.
  • This node is a genuinely lighter alternative to installing controlnet_aux just for edges - but if you're already running controlnet_aux, you have Canny/Sobel covered and only pyracanny here is the rare find.
CategoryNikosis Nodes/preprocessors

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
modelCOMBOpyracanny5 options: canny, laplacian, prewitt, pyracanny, sobel
low_thresholdINT1000–255
high_thresholdINT2000–255
resolutionINT51264–2048
keep_proportionBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE