Nodes/ComfyUI-Nikosis-Preprocessors/Laplacian Preprocessor (nikosis)
ComfyUI Node

Laplacian Preprocessor (nikosis)

Second derivatives, one extra knob, no model

By Nikosis·Created about a year ago·Updated about a year ago· 2
Laplacian Preprocessor (nikosis)
  • image
  • IMAGE
low_threshold100
high_threshold200
ksize3
resolution512
keep_proportiontrue

Let's be honest about what this node is: it's the same laplacian detector you get by picking "laplacian" in this pack's Edge Preprocessor, pulled out as a standalone node with exactly one extra parameter. If you already run that Edge node, you can skip this one. But if you want a fixed Laplacian edge map without touching a five-way dropdown, or you specifically care about the kernel size, it's a tidy little tool.

What a Laplacian edge map is

Canny looks for gradients and thins them into clean single-pixel lines. The Laplacian instead takes the second derivative - the rate of change of the rate of change. It fires on both sides of an edge, which makes maps look doubled-up and noisy compared to Canny. That sounds like a downside, and for classic ControlNet conditioning it usually is. Where Laplacian earns its keep is detecting rapid intensity change regardless of direction: focus and defocus maps, blur estimation, that kind of thing. It's a specialist's detector, not your default edge map.

Inputs

  • image - your input.
  • low_threshold / high_threshold (default 100/200, range 0–255) - the double-threshold pair, same as the Edge node: above high is a strong edge, between low and high is weak.
  • ksize (default 3, 1–31, odd only, step 2) - the extra knob. This is the size of the Laplacian kernel. 1 is tiny and noisy; larger values blur over more area and give smoother, coarser responses. If the map looks like static, bump ksize up before touching thresholds.
  • resolution (default 512, 64–2048, step 16) and keep_proportion (default on) - identical to the pack's other edge nodes: resolution sets the shorter-side target; keep_proportion either crops to a multiple of 16 while holding aspect, or stretches slightly to hit it.

Output is one IMAGE - the thresholded edge map, white on black, 3-channel, ready for an edge ControlNet if you insist, or for whatever downstream analysis you're doing.

Installing it

Same pack, same dance as every node here: ComfyUI-Nikosis-Preprocessors from Nikosis (the author behind the ComfyUI-Nikosis-Nodes prompt/style pack). Either ComfyUI Manager → search ComfyUI-Nikosis-Preprocessors → Install → restart, or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Nikosis/ComfyUI-Nikosis-Preprocessors comfyui-nikosis-preprocessors
cd comfyui-nikosis-preprocessors
pip install -r requirements.txt    # Windows portable: ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt

Then restart ComfyUI. The engine here is opencv-python (it's in requirements.txt) - there are no model files, so no downloads and no offline surprises. If it fails on import, pip install opencv-python is your fix.

Should you use it?

If you're here because a tutorial told you to add a Laplacian preprocessor for ControlNet, hold on - Canny or pyracanny (from this same pack's Edge node) will almost always serve you better for edge conditioning. Grab this node for the niche jobs: defocus detection, sharpness analysis, or when you genuinely want that second-derivative character. It does one thing, does it with one extra knob, and costs nothing to have around.

CategoryNikosis Nodes/preprocessors

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
low_thresholdINT1000–255
high_thresholdINT2000–255
ksizeINT31–31
resolutionINT51264–2048
keep_proportionBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE