Nodes/ComfyUI-FaceChain/FC RemoveCannyFace
ComfyUI Node

FC RemoveCannyFace

Erasing the face from a Canny map — FC RemoveCannyFace

By THtianhao·Created 3 years ago·Updated about a year ago· 147
FC RemoveCannyFace
  • source_image
  • canny_image
  • IMAGE

FC RemoveCannyFace solves a very specific problem in the FaceChain inpainting workflow: you've got a Canny edge map of a face image, and you want the face's edges gone from it so the ControlNet doesn't try to lock the inpaint pass onto the old facial structure.

Here's the setup that makes it make sense. The classic FaceChain inpaint graph runs a Canny ControlNet on the source to hold the overall structure, generates a new face into a crop, then pastes it back. But a Canny map of a photo contains the face's edges too - eyes, mouth, jawline - and if those old facial edges survive into the ControlNet input, your freshly generated face gets dragged back toward the original. This node is the eraser. It detects the face in the source, segments it, and zeroes out every Canny edge inside that region before the map reaches the ControlNet.

Inputs and output

  • source_image (IMAGE) - the original photo. It's used to find the face region and segment it; the Canny map itself doesn't come from here.
  • canny_image (IMAGE) - the Canny edge map you want cleaned. This is the output of a Canny preprocessor running on the same image.
  • One IMAGE output - the Canny map with the face area blacked out.

Under the hood it's the pack's usual pipeline in miniature: face detection to find the face, a segmentation pass to get the face mask (cropped above the eye line, so the forehead region gets cleaned too), then canny * (1 - mask) to wipe the edges inside the mask. Anything outside the face is untouched.

Where it fits

In the workflow, wire it between your Canny preprocessor and the ControlNet application. The cleaned map gives the ControlNet the structure of the hair and background without freezing the facial features - exactly what you want when the whole point of the pass is to regenerate the face. It pairs with FC FaceSegment conceptually; if you want to see what region got erased, run the same segment and compare.

Install and practical notes

Part of ComfyUI-FaceChain: ComfyUI Manager (search "ComfyUI-FaceChain") or git clone https://github.com/THtianhao/ComfyUI-FaceChain into custom_nodes/, then restart. It triggers the pack's ModelScope detection and segmentation downloads on first use (from modelscope.cn), and the pack-wide startup dependency install applies.

Honest caveats: the node assumes the Canny map aligns pixel-for-pixel with the source image, which it does if you didn't resize between them - so don't. And because it erases everything inside the face mask including the jawline, the inpaint model has less structure to anchor the chin; that's the intended trade-off, but if your output faces look floaty, you can keep more structure by skipping this node and letting the ControlNet see the full map at lower strength instead.

Categoryfacechain/model

Inputs (2)

NameTypeDefaultDescription
source_imageIMAGE
canny_imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE