Image Edge Detect (Sobel)

Apply a Sobel edge-detection filter to highlight outlines.

Open tool

Overview

The Image Edge Detect tool runs a Sobel filter over an uploaded image and returns a grayscale map of the edges it finds. Bright pixels mark regions of sharp gradient — outlines, silhouettes, hard shadows — while flat regions render as black. Drop in any photo and the result reads like a coloured-pencil sketch.

This is the classic first step in computer-vision pipelines (line tracing, OCR pre-processing, lane detection), but it is also a popular artistic effect for posters, T-shirts and stylised social posts. Web designers use it to build instant "outline" badges from product photography.

How it works

The Sobel operator approximates the image gradient by convolving against two 3x3 kernels — one for horizontal change, one for vertical. The horizontal kernel is [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]] and the vertical kernel is its transpose. After convolution each pixel has an estimated gradient vector (Gx, Gy).

The output magnitude is sqrt(Gx^2 + Gy^2) (or the cheaper |Gx| + |Gy| approximation) and the optional direction is atan2(Gy, Gx). Magnitudes are scaled to 0-255 and written to the output. Some pipelines run a Gaussian blur first to suppress noise, then optionally apply non-maximum suppression to thin the edges down to single-pixel lines.

Examples

Source: portrait.jpg
Result: silhouette of the subject's face and hair outlined in white,
        skin texture suppressed in mid-grey.

Source: cityscape.jpg
Result: building edges, window frames and skyline traced cleanly,
        sky and pavement appear black.

Source: handwriting.png
Result: glyph outlines preserved — useful as a pre-OCR pass.

FAQ

Why is my edge map noisy?

Sensor or compression noise produces strong local gradients. Run a small Gaussian blur first (sigma around 1) to smooth high-frequency texture before edge detection.

How is Sobel different from Canny?

Sobel produces a raw magnitude map. Canny adds non-maximum suppression and dual-threshold hysteresis on top to give clean single-pixel edges suited to vectorisation.

Does it work on colour images?

The image is converted to grayscale first using Rec. 709 luminance, then the gradient is computed on the single channel.

Can I tune the kernel size?

The Sobel kernel is fixed at 3x3 here. Larger kernels (Scharr, 5x5 Sobel) trade speed for noise tolerance and are typically reached for in dedicated vision libraries.

What format is the output?

A single-channel grayscale PNG. Drop it into image-editing software as a layer mask if you want to colour the edges.

Try Image Edge Detect (Sobel)

An unhandled error has occurred. Reload ×