ZImage SDNQ Canny Preprocess
The edge map that makes Z-Image build to your sketch, not its own mood
- image
- image
Canny is the oldest trick in the ControlNet book and it still does one job better than anything newer: turn a photo into a set of hard lines the model has to respect. If your Z-Image workflow is about architecture, machinery, or any scene where the outline is the content, this node is the half-second step between "input image" and "controlled generation" in the comfyui-zimage-sdnq pack.
What it does is simple. It runs classic Canny edge detection on your image and hands you back a black-and-white edge map: white pixels where a real boundary exists, black everywhere else. That map is what you feed into the control_image input of ZImageSDNQSamplerControl, which passes it to Z-Image's Fun ControlNet. The prompt then decides what gets drawn and the Canny map decides where the lines go.
The two inputs that matter
Only two settings, and both are thresholds:
- low_threshold (default 0.4) - the leniency dial. Any gradient stronger than this starts being considered an edge.
- high_threshold (default 0.8) - the strictness dial. Edges above this are kept outright; the in-between ones survive only if they connect to something strong. That hysteresis is the classic Canny behavior, and it's why the pair beats any single threshold.
The practical reading: lower low_threshold and you drag in hair, fabric grain, sensor noise - the model will obediently draw all of it. Raise both and you're left with clean structural lines, which is what you want for buildings and mechanical subjects. Start at the defaults and move in 0.1 steps; if your output looks like a nervous sketchbook, your low threshold is too low.
The only other input is image, and the only output is image - same resolution as what went in. There's no batch surprise here either; it processes every frame in the batch.
Where it sits in a workflow
The pack ships an example graph (zimage_sdnq_control_canny.json) and the wiring is exactly what you'd expect:
LoadImage → ZImageSDNQCannyPreprocess → ZImageSDNQSamplerControl → PreviewImage
↑
ZImageSDNQControlPipelineLoader → (pipeline) ──────┘
One thing to know: the Canny node itself has no dependency on the SDNQ pipeline. You could run it standalone as a pure edge extractor if you ever want the map for something else. It just happens to live in this pack because the control workflow needs it.
Installation and gotchas
Same install as the rest of the pack - ComfyUI Manager (search "Z-Image SDNQ"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/GeneralShan/comfyui-zimage-sdnq
Then restart ComfyUI. Canny itself needs OpenCV, which is one of the controlnet dependencies the pack lists (opencv-python-headless). If you only ever used the base text-to-image nodes and suddenly get an import error after adding a preprocessor, that's the missing piece - pip install opencv-python-headless in your ComfyUI environment.
The classic beginner trap isn't technical, it's conceptual: a Canny map is composition control, not appearance control. Z-Image Turbo follows edges faithfully but keeps its own ideas about texture, lighting, and style. If you wanted a photo that looks like the source photo, you want the tile upscaler, not Canny. Feed this node when you want the layout to be locked down and everything else free.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| low_threshold | FLOAT | 0.400.01–0.99 | — |
| high_threshold | FLOAT | 0.800.01–0.99 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |