Nodes/ComfyUI_Anytext/Common Cv2 Canny
ComfyUI Node

Common Cv2 Canny

A bare-bones OpenCV edge map, bundled so you don't need another pack

By zmwv823·Created 2 years ago·Updated about a year ago· 103
Common Cv2 Canny
  • image
  • IMAGE
low_threshold64
high_threshold100

Sometimes a node is exactly what it says on the tin, and this is one of them. It runs OpenCV's Canny edge detector on an image and hands you back the edge map. That's it. No AI, no model download, no HuggingFace weights - just the classic computer-vision algorithm that's been detecting edges since long before diffusion models existed. The pack bundles it so that its JoyType text pipeline has a self-contained way to turn a rendered image into a canny map without making you install a whole separate preprocessor pack.

That's the context that makes it click. Canny is, per the KB, "the classic" ControlNet condition - it detects hard edges with configurable thresholds and produces clean, thin edge maps, which is why it's the go-to for anything with clear contours. JoyType renders your text as glyph shapes; this node traces the edges of those glyphs; that canny map then conditions a canny ControlNet so the diffusion model draws stylized text that follows the letterforms. So while you can use this node as a general-purpose canny preprocessor for any ControlNet workflow, its home turf is the "text → glyphs → canny → ControlNet" chain this pack is built around.

The two thresholds, and how Canny actually uses them

There are three inputs and only two you ever touch. image is your source. The other two are the whole game:

  • low_threshold (default 64, range 0–500)
  • high_threshold (default 100, range 0–500)

Here's the mechanism, because understanding it saves you a lot of blind slider-wiggling. Canny uses hysteresis: any edge stronger than high_threshold is kept as a definite edge; anything weaker than low_threshold is thrown out; anything in between is kept only if it connects to a strong edge. So the two numbers together decide how much detail survives. Lower both and you get a busy, noisy map full of faint edges. Raise both and you get a sparse map that keeps only the boldest contours - and can drop thin strokes entirely. For crisp letterforms the defaults (64/100) are a sensible starting point; nudge them up if the map is picking up background noise, down if fine strokes are vanishing.

The single output is a plain IMAGE - the edge map - which wires straight into a ControlNet apply node (the pack's Diffusers Apply ControlNet, or Comfy's native one, since a canny map is just an image).

Installing it

Nothing special. It rides along with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/zmwv823/ComfyUI_Anytext

Restart ComfyUI, or install ComfyUI_Anytext through ComfyUI Manager and restart. OpenCV comes in with the pack's dependencies, so there's no extra model to download - this is the one node in the whole pack that needs zero weights.

Where people get stuck

Honestly, not many places, which is the charm. The one real gotcha is threshold intuition running backwards: if your text comes out with broken or missing strokes, people crank the thresholds up thinking they're "sharpening" the edges, when raising the high threshold is exactly what deletes the faint strokes. If edges are dropping, lower the numbers. If the map is a snowstorm of noise, raise them.

The other thing worth saying plainly: this is a deliberately minimal canny. It doesn't have the resolution controls or the variant options of the dedicated preprocessor packs like comfyui_controlnet_aux. If you just want a solid canny node for general ControlNet work, one of those gives you more knobs. Cv2 Canny earns its place by being simple, dependency-light, and already sitting in the pack you installed for the text pipeline.

CategoryUL Group/Image Process Common

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
low_thresholdINT640–500测试
high_thresholdINT1000–500测试

Outputs (1)

NameTypeDescription
IMAGEIMAGE