Detect Edges in an Image
Find the outlines in a photograph. A Sobel filter measures how fast brightness changes at every pixel, so boundaries light up and flat areas go black. Invert it and you have a pencil-sketch effect; threshold it and you have clean line art for tracing.
Drop images here
Multiple files allowed
What Sobel measures
For every pixel, two 3×3 kernels estimate the horizontal and vertical rate of change in brightness, and the output is the magnitude of that gradient. A pixel in the middle of a flat wall has no gradient and comes out black; a pixel on the boundary between a dark jacket and a bright sky has a large one and comes out white. Because it works on brightness, two very different colours of identical brightness produce no edge at all — which is occasionally surprising and always worth knowing.
Threshold converts the greyscale gradient into pure black and white at the cutoff you set. Leave it at 0 to see the full range of edge strengths; raise it to 30–60 to keep only strong boundaries and suppress texture and sensor noise. Too high and outlines break into dashes.
The three useful outputs
Default — white lines on black. This is the diagnostic view, and the input a vectoriser or a CNC path generator wants.
Inverted — dark lines on white. This is the pencil-sketch look, and it's much more presentable. Combine with a moderate threshold for a clean ink-drawing effect, then PNG to SVG to trace it into vector line art.
Colour mode — the original colours, kept only where edges are strong and fading to black elsewhere. It gives a neon-outline look that's good for posters and title cards.
Blur first if your source is noisy. Blur at 1–2 px removes grain that would otherwise appear as a fine speckle of false edges — this is exactly what a Canny detector does internally before its own edge pass.
FAQ
Is this Canny edge detection?
No, it's Sobel gradient magnitude with an optional threshold. Canny adds non-maximum suppression and hysteresis to produce single-pixel-wide connected edges. Sobel is simpler and gives thicker, softer lines.
My output is almost entirely black.
Low-contrast source, or the threshold is too high. Set threshold to 0 first to see what's actually there, and try boosting contrast beforehand.
Everything is covered in speckles.
Sensor noise or JPEG artefacts being detected as edges. Blur the source slightly, or raise the threshold.
Is transparency handled?
The alpha channel is preserved, but note that the boundary between opaque and transparent counts as a brightness edge and will be detected.