VKriez Enhanced Edge Preprocessor
VKriez Enhanced
- image
- IMAGE
Every edge preprocessor has the same two failure modes: too noisy, or broken lines. Plain Canny gives you a confetti of specks and texture; most "clean" preprocessors fix that but leave your outlines looking like a cracked windshield. The VKriez Enhanced Edge Preprocessor is the classical pipeline that tries to fix both at once - no model download, no GPU requirement, just OpenCV/skimage work that produces continuous, even-thickness lines. If you've got a technical drawing, a product shot, or a comic page and you want a deterministic edge map ControlNet actually respects, this is the one you'll reach for. It's also the classical half of the pack's fancier Hybrid MTEED node, so understanding this one teaches you the shared knob set.
How it works
It's a staged OpenCV pipeline, and you can switch each stage on or off:
- Adaptive regions - a saliency mask splits the image into foreground/background so later stages can treat them differently.
- Bilateral filter (optional) - smooths flat areas while keeping edges sharp, so skin texture and grain don't become phantom edges. The
use_gpu_accelerationtoggle swaps in a fast torch approximation of bilateral when CUDA is available, and falls back tocv2.bilateralFilteron CPU (or if the GPU path throws). - CLAHE - local contrast enhancement so faint edges in shadows and highlights survive Canny.
- Canny - with low/high thresholds and aperture, using L2 gradient.
- Edge linking - the headline feature. It finds line endpoints with a Sobel-based trick and connects endpoints that are close (within
gap_thresholdpixels) and roughly aligned (angle_thresholddegrees), searching only a local bounding box around each endpoint. That "local search instead of global" detail is why it's faster than naive linking algorithms. This is the stage that fixes broken lines. - Morphology - closing to fuse nearby segments.
- Component filter - deletes small isolated specks below
min_component_size. - Edge consistency - skeletonizes then optionally re-dilates to
target_edge_thickness(1–3), so lines are uniform rather than ragged.
Inputs and outputs that matter
Image in, one IMAGE out - the edge map, which you wire into a ControlNet Apply node (or a Preview node first). Of the ~22 inputs, a beginner sets three or four:
- canny_low_threshold / canny_high_threshold (defaults 100/200): the classic Canny dials. Lower lows catch faint lines; raise the high to 220–250 to kill noise.
- gap_threshold (1–10, default 3) and angle_threshold (5–90, default 30): how aggressively broken lines get stitched together. Raise both for sketches with big gaps; keep angle moderate or you'll bridge things that shouldn't connect.
- min_component_size (5–500, default 20): the speckle killer. Crank it for noisy scans.
Everything defaults to on, which is opinionated but usually right. The use_edge_linking toggle is the single biggest speed lever - linking is the most computationally expensive stage, and turning it off makes preview iterations much faster.
Installing it
cd ComfyUI/custom_nodes/
git clone https://github.com/vadimcro/VKRiez-Edge.git
Then restart ComfyUI. That's genuinely it for this node - no model download, no pip extras, no CUDA requirement (CPU works, just slower). Or search "VKRiez-Edge" in ComfyUI Manager, which also keeps it updatable. The pack needs OpenCV and scikit-image, which ComfyUI's bundled environment already ships.
Troubleshooting
- Too many edges / noise: raise Canny high threshold toward 220–250, bump
min_component_sizeto 50–100, and/or increase bilateral diameter and sigmas. - Important edges missing: drop Canny low to 50–70, raise the CLAHE
clip_limittoward 3–4. - Gaps: raise
gap_thresholdto 5–7 andangle_thresholdto 45–60, or bump morphology kernel/iterations. - Edges too thick: reduce morphology and bilateral; set
target_edge_thicknessto 1. - Slow: disable edge linking, or smaller bilateral diameter. The GPU toggle only helps the bilateral stage - everything else is CPU OpenCV regardless.
One caveat worth knowing: it's a small, single-author pack (VKriez, March 2025) with basically no community track record yet, so treat the defaults as a starting point, not gospel. Preview before you commit a workflow to it.
Inputs (25)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| use_bilateral | BOOLEAN | true | — |
| use_gpu_acceleration | BOOLEAN | true | — |
| bilateral_d | INT | 75–15 | — |
| bilateral_sigma_color | FLOAT | 7510–200 | — |
| bilateral_sigma_space | FLOAT | 7510–200 | — |
| use_clahe | BOOLEAN | true | — |
| clip_limit | FLOAT | 2.00.5–10 | — |
| tile_grid_size | INT | 82–16 | — |
| canny_low_threshold | INT | 1000–255 | — |
| canny_high_threshold | INT | 2000–255 | — |
| canny_aperture | INT | 33–7 | — |
| use_edge_linking | BOOLEAN | true | — |
| gap_threshold | INT | 31–10 | — |
| angle_threshold | INT | 305–90 | — |
| use_morphology | BOOLEAN | true | — |
| morph_kernel_size | INT | 31–7 | — |
| morph_iterations | INT | 11–3 | — |
| use_component_filter | BOOLEAN | true | — |
| min_component_size | INT | 205–500 | — |
| use_adaptive_regions | BOOLEAN | true | — |
| use_enhanced_filtering | BOOLEAN | true | — |
| connectivity_threshold | INT | 21–5 | — |
| use_edge_consistency | BOOLEAN | true | — |
| target_edge_thickness | INT | 11–3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |