Nodes/ComfyUI-CN-Pre/ControlNet Pre (+Model/ControlNet): Canny
ComfyUI Node

ControlNet Pre (+Model/ControlNet): Canny

Canny — an edge preprocessor with a pass-through bundle

By OKIE5·Created 10 months ago·Updated 10 months ago· 0
ControlNet Pre (+Model/ControlNet): Canny
  • image
  • model
  • clip
  • vae
  • control_net
  • control_image
  • model
  • clip
  • vae
  • control_net
low_threshold100
high_threshold200
aperture_size
blur_type
blur_radius1.00
dilate_iter0
kernel_size3
invert_output
edge_gain1.00
edge_bias0.00

Canny is the oldest trick in the ControlNet book - a hard-edge detector that turns a photo into clean, thin outlines, and it's still the go-to for architecture, product shots, and anything with crisp contours. This version of it lives in a small, fairly obscure pack called ComfyUI-CN-Pre, and its whole reason for existing seems to be giving you more manual dials on that classic Canny algorithm than the standard pack does, plus wiring convenience you don't get elsewhere.

What makes this Canny node different

Under the hood it's the same idea everyone's used since ControlNet launched in 2023: two-threshold hysteresis edge detection (low_threshold/high_threshold, defaulting to 100/200) - pixels above the high threshold are definitely edges, pixels below the low threshold definitely aren't, and everything in between only counts if it connects to a strong edge. What's different here is how much of the pipeline around that core algorithm you get to touch. aperture_size (3/5/7) controls the Sobel kernel used to compute gradients before thresholding - bigger apertures smooth out noise but blur fine detail. blur_type and blur_radius let you pre-blur the image (gaussian, median, or bilateral) before edge detection runs, which is the standard trick for taming a noisy or grainy source photo so Canny doesn't pick up every speck as an edge. dilate_iter and kernel_size thicken the resulting edge lines after the fact, which helps if your ControlNet checkpoint wants bolder lines than raw Canny produces. And edge_gain/edge_bias let you scale and shift the edge intensity directly, which is a cheap way to nudge how strongly the map reads without touching your ControlNet's strength slider at all.

The pack's other quirk: every "Loaders" node in it - this one included - carries optional model, clip, vae, and control_net inputs that pass straight through, unmodified, to matching outputs. It's not doing anything to them; it's letting you route your model bundle through the same node that's generating your control image, so you don't need a separate reroute node to keep a tidy graph. If you don't need that, just ignore the optional inputs - the node works fine with only image connected.

What to wire and what to skip

The only required input besides image you actually need to think about is the threshold pair - invert_output if your target ControlNet expects white lines on black instead of the reverse, and edge_gain/edge_bias if the map looks weak in the preview. Everything else (aperture, blur, dilate, kernel size) is fine-tuning you can leave at default until something specific looks wrong. The node outputs control_image (IMAGE), which is what goes into your ControlNet Apply node - and, if you wired anything into the optional passthrough inputs, matching model/clip/vae/control_net outputs alongside it.

Installing it, and the honest state of the docs

Search ComfyUI-CN-Pre in ComfyUI Manager and install, or by hand: cd ComfyUI/custom_nodes && git clone https://github.com/OKIE5/ComfyUI-CN-Pre, then restart. Here's the thing worth knowing going in - the pack's README is a single mismatched line that doesn't describe this pack at all, so there's no documented dependency list, no license note, and (worth saying plainly) no community discussion of this pack anywhere in the usual places. It's a low-profile, single-author tool. You most likely landed here because a workflow you downloaded uses it, not because you went looking for it - and that's fine, this specific node is safe ground: it's pure OpenCV, no external model weights to hunt down, no first-run download to wait on. It's the most reliable node in the whole pack for exactly that reason.

Where people get burned

Because there's no documentation, the parameter names are genuinely your only guide - there's no tooltip layer to lean on. If your edge map looks like static, raise low_threshold first before touching anything else; that's almost always a thresholding problem, not an aperture or blur problem. If your ControlNet output looks like it's ignoring the structure entirely, check invert_output - a black-on-white map fed to a checkpoint trained on white-on-black (or vice versa) will produce something that technically runs but looks wrong. And if you're comparing this against the standard Fannovel16/comfyui_controlnet_aux Canny node and wondering why the results differ slightly even at matching thresholds, it's the extra blur/dilate/gain pipeline stages doing their thing by default - set blur to none and dilate to 0 if you want a closer apples-to-apples match to the plain algorithm.

CategoryCtrlNet/Pre

Inputs (15)

NameTypeDefaultDescription
imageIMAGE
low_thresholdINT1000–255
high_thresholdINT2000–255
aperture_sizeCOMBO3 options: 3, 5, 7
blur_typeCOMBO4 options: none, gaussian, median, bilateral
blur_radiusFLOAT1.000–5
dilate_iterINT00–5
kernel_sizeINT31–7
invert_outputCOMBO2 options: false, true
edge_gainFLOAT1.000.5–2
edge_biasFLOAT0.00-0.5–0.5
modeloptMODEL
clipoptCLIP
vaeoptVAE
control_netoptCONTROL_NET

Outputs (5)

NameTypeDescription
control_imageIMAGE
modelMODEL
clipCLIP
vaeVAE
control_netCONTROL_NET