IMG · Images tools

Edge Detection

Shareable link

Settings are written to the URL as you change them. Nothing differs from the defaults yet.

Edge detection is a derivative. Convolve an image with a kernel that approximates the rate of change in brightness, take the magnitude of the horizontal and vertical results, and what remains are the places where the picture stops being one thing and starts being another.

The four operators

All four are 3×3 kernels, and the differences between them are entirely about weighting.

Sobel gives the centre row and column double weight, which acts as a light smoothing pass built into the derivative. Prewitt weights every row equally, so it is a purer difference and correspondingly noisier. Scharr pushes the centre weighting further still, at 10 against 3, and is the most rotationally accurate of the three for diagonal structure.

Laplacian is different in kind. It is a second derivative, so instead of measuring how fast brightness changes it measures where that rate itself turns over. Lines come out thinner and often doubled, one on each side of the true edge.

Pre-Blur

A derivative amplifies high frequencies, and in most real photographs the highest frequencies are noise. Running Sobel on an unprocessed phone photo returns a field of speckle with the structure buried inside it.

Blurring first is not a cosmetic step, it is the standard first stage of every classical edge pipeline. The radius here is a share of the shorter image side, so the same setting behaves identically on a preview and a full-resolution export.

Start around 10% to 20% for camera images and 0% for screenshots and vector renders, which have no sensor noise to suppress.

Sensitivity and threshold

Gradient magnitude is normalised against the strongest edge in the frame before Sensitivity is applied, so the slider means roughly the same thing across images with very different local contrast.

Threshold is the step that changes the kind of output. At 0% the result is continuous and reads as a soft luminous line drawing. Above 0% every pixel is forced to one of two values, which is what a trace, a mask, or a cutting path actually needs. There is no partial coverage in that mode.

Output modes

White on black is the conventional presentation and the easiest to judge. Black on white inverts it for print and for tracing. Source colour at the edges multiplies the original pixels by the gradient, which keeps hue information and suits compositing over the untouched image. The custom pair sets both colours directly.

Limits

The gradient is computed from luminance, so an edge between two colours of equal brightness returns nothing. A saturated red beside a mid-grey of the same luminance is invisible to every operator here. When that matters, separate the two with a channel mixer first and run the detection on the result.

Frequently Asked Questions

It convolves the image with a 3×3 derivative kernel and maps the resulting gradient magnitude to output pixels, so areas where brightness changes fastest become the brightest lines. Accepts JPEG, PNG, and WebP.

Sobel is the general default and weights the centre row twice, which suppresses noise. Scharr uses a steeper weighting and is more accurate for diagonal edges. Prewitt weights all rows equally and responds more to noise. Laplacian is a second derivative, so it fires on the zero crossing and produces thinner, double-sided lines.

A derivative amplifies whatever varies fastest, and on a compressed or high-ISO photo that is sensor noise and JPEG blocking rather than structure. Raise Pre-Blur until the noise flattens, then raise Sensitivity again.

At 0% the output keeps the full gradient as a continuous value. Above 0% every pixel is forced to either a line or the background, which is what a downstream trace, mask, or laser path needs. It is one bit per pixel, not a soft edge.

No. Canny adds non-maximum suppression and hysteresis thresholding on top of a gradient, which thins edges to one pixel and links weak segments to strong ones. This tool exposes the gradient stage and a single threshold, so its lines are thicker and unlinked.

Explore Our Tools

Browse all tools