Find edges

Read more about the edge-detection algorithms you can try in Edge effects—and how each method finds the outlines in a photo.

Photo with edge detection applied in PictorX, showing traced outlines
Photo with edge detection applied in PictorX, showing traced outlines

How edge detectors find outlines

An edge is a place where brightness or color changes quickly—the outline of a face, a building, or a leaf against the sky. Detectors scan every pixel, compare it with its neighbors, and turn those sudden changes into lines. The methods below all start from that idea, but they measure the change in different ways, so the same photo can become thin ink lines, a soft pencil sketch, or a thick shape contour.

Find Edges

Find Edges converts the photo to grayscale, then applies two small Sobel kernels: one looks left–right, the other up–down. Combining them as \(\sqrt{g x^{2} + g y^{2}}\) gives each pixel a strength: how sudden is the change here? Strong changes become edges. PictorX inverts the result by default, so you get dark lines on a light field—the classic line-art look. You can keep transparency so the outline sits over whatever is behind the layer.

Albrecht Dürer, Rhinoceros, 1515, a woodcut built from outlines
Albrecht Dürer, Rhinoceros, 1515, a woodcut built from outlines

Sobel

Sobel uses the same left–right and up–down kernels, but it measures each color channel separately. The outline keeps a hint of the original colors instead of a flat gray sketch. Compared with Canny, Sobel is a softer gradient: edges have thickness and falloff instead of a one-pixel binary line. Invert is on by default for a printable look.

A leaf against the sky, a sharp edge of light and dark
A leaf against the sky, a sharp edge of light and dark

Laplace

The Laplacian looks at the second derivative: not only “is brightness changing?” but “is that change itself peaking?” PictorX uses a 5×5 kernel with 24 in the center and −1 around it. Where an edge is sharp, the response spikes; flat areas stay near zero. The result is inverted. Laplace often picks up finer texture than Sobel—fabric, hair, foliage—so it can look busier.

Portrait of Pierre-Simon Laplace
Portrait of Pierre-Simon Laplace

Canny

Canny is a pipeline, not a single kernel. The photo is converted to grayscale and blurred so noise does not become false edges. A Sobel step then finds gradient strength and direction. Non-maximum suppression keeps only the ridge of each edge, thinning wide gradients to a one-pixel line. Finally two thresholds and hysteresis decide what stays: pixels above the high threshold are definite edges; pixels between low and high are kept only if they connect to a definite edge. The result is clean binary line art. Raise the blur to ignore texture; raise the high threshold to keep only the strongest outlines.

Canny edge detection example in PictorX: thin binary line art from a photo
Canny edge detection example in PictorX: thin binary line art from a photo

Glowing Edges

Glowing Edges is the color Sobel without inversion: bright colored strokes on a dark field. Each RGB channel contributes its own glow, which reads as a neon outline rather than printed line art.

XDoG

XDoG (Extended Difference of Gaussians) compares two blurs of the same photo: a slightly tighter blur and a wider one (about 1.6×). Subtracting them—weighted by an amount τ—highlights the band of contrast between those scales, which is where a drawing would place a stroke. A threshold then turns that difference into ink. Soft strokes use a smooth falloff (gray pencil); hard strokes are black or white. XDoG looks more like a sketch than a scientific edge map.

XDoG sketch example in PictorX: pencil-style strokes from a photo
XDoG sketch example in PictorX: pencil-style strokes from a photo

Morphological Gradient

Morphological Gradient does not use derivative kernels. It dilates the photo (each pixel becomes the brightest neighbor in a radius) and erodes it (the darkest neighbor), then subtracts. The leftover is a band around every shape, as thick as the radius. That follows the silhouette more than fine texture, so it is useful when you want a bold contour instead of every wrinkle.

Morphological Gradient example in PictorX: thick shape contours from a photo
Morphological Gradient example in PictorX: thick shape contours from a photo

Which method should I use?

Use Canny for thin, clean outlines. Use Find Edges or Sobel when you want a classic photo-to-line look with some gray falloff. Choose Laplace for extra texture, Glowing Edges for neon color on black, XDoG for a pencil or ink sketch, and Morphological Gradient for thicker shape contours. You can try every look on the Edge effects page.

Frequently asked questions

照片中的「邊緣」是什麼?

邊緣是亮度或顏色的突然變化—也就是輪廓。偵測器會在每個像素測量這種變化,並把最強的變化變成線條。

Canny 和「尋找邊緣」有何不同?

「尋找邊緣」(以及 Sobel)會顯示邊緣強度的柔和梯度。Canny 會先模糊,把那些梯度細成單像素脊線,再用兩個閾值,只留下最乾淨的線條。

為什麼「尋找邊緣」會反轉照片?

預設情況下,邊緣會變成淺色底上的深色線條—就是熟悉的線稿外觀。關閉「反轉」則會得到黑底上的亮邊緣。

哪一種方法最像鉛筆素描?

XDoG。它會比較兩次模糊,並在對比落在那些尺度之間的地方畫出筆觸,比科學邊緣圖更接近墨水或鉛筆。

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Try edge effects