Home  /  Guides  /  What three edge operators do to a batch

One Edge Button, Three Different Answers

Updated 2026-11-24 · measured on 12 mixed files, 20,934,926 bytes, three operators plus strength and threshold sweeps

The short answer

Edge detection is not one result. Roberts and Sobel disagreed on 7,101,949 of 12,000,000 pixels on the landscape photo — 59.183%. Sobel and Laplacian differed on 7,079,312, or 58.994%, of the same frame.

Strength does not find more edges. Raising it from 1.0 to 3.0 left the share of non-zero pixels unchanged at 60.238% while the share clipped to 255 rose from 6.352% to 16.479%. One batch of 11 decoded files produced edge maps whose density ran from 0.556% to 78.945% under the same settings.

This page measures what the operator choice, the strength control and the threshold do across a folder of mixed files. For other one-in-one-out operations on the same twelve files, see the batch invert measurement, the batch grayscale measurement, the batch sharpen measurement and the batch equalize measurement. For a rectangle across a folder, the batch crop measurement covers padding; for a blur radius family, the batch blur measurement covers three filters. For flipping, start at the photo flipper.

1. The batch and where the numbers come from

Twelve files, 20,934,926 bytes on disk and 63,016,384 pixels across the 11 that decoded. Every readable file was reduced to one grayscale channel, then filtered with three operators: Roberts cross, Sobel-Feldman and a 3 by 3 Laplacian. Each output was clipped to the 0 to 255 range, written as an 8-bit grayscale PNG, reopened and measured against the decoded input. Eleven files times three operators equals 33 edge maps; one truncated file produced nothing.

What the twelve files were: two byte-identical 3000 x 4000 portrait JPEGs, one 4000 x 3000 landscape JPEG, one 3000 x 4000 grayscale JPEG, one 2000 x 1500 JPEG with an orientation tag, one 3000 x 3000 PNG, one 1200 x 800 transparent PNG, one 128 x 128 PNG icon, one 1600 x 900 WebP, one 400 x 300 six-frame GIF, one 800 x 600 16-bit grayscale PNG, and one truncated 1,200-byte JPEG. Nothing left the machine. Pillow 13.0.0, numpy 2.5.4 and Python 3.13.14.

2. The operators disagree on most of the image

This is the gap the tool pages leave unmeasured. Three operators are offered as if they were three labels on one control. On a real photo they produce substantially different maps. The table counts pixels where the clipped 8-bit outputs of two operators differ, on the same decoded bytes.

FilePixelsSobel vs RobertsSobel vs LaplacianMean abs gap
photo_landscape.jpg12,000,0007,101,949  (59.183%)7,079,312  (58.994%)28.506
photo_portrait.jpg12,000,0007,115,458  (59.295%)7,089,387  (59.078%)28.554
photo_square.png9,000,0006,959,149  (77.324%)6,953,081  (77.256%)37.911
duplicate_photo.jpg12,000,0007,115,458  (59.295%)7,089,387  (59.078%)28.554
exif_orient6.jpg3,000,0001,742,519  (58.084%)1,742,552  (58.085%)30.411
screenshot.webp1,440,000817,011  (56.737%)814,805  (56.584%)31.377
logo_alpha.png960,0008,324  (0.867%)8,744  (0.911%)1.423
gray_16bit.png480,0002,668  (0.556%)2,669  (0.556%)0.823
gray_8bit.jpg12,000,0007,108,511  (59.238%)7,083,447  (59.029%)28.613
animation.gif120,000504  (0.42%)996  (0.83%)1.064
small_icon.png16,38411,526  (70.349%)11,542  (70.447%)48.921
broken.jpgtruncated, failed to decode; no output written

Mean abs gap is the average absolute difference between the two 8-bit outputs on a 0 to 255 scale. The two byte-identical portrait JPEGs produced byte-identical maps, so their rows match.

Sobel vs Roberts, pixels that differ photo_square 77.324% small_icon 70.349% photo_landscape 59.183% gray_16bit 0.556% animation 0.42%
Share of pixels where the Sobel and Roberts outputs differ, on five of the eleven readable files. Scaling is linear to 100 percent.
Your call: the operator that draws the lines you want is a visual judgement. These numbers only show that the choice changes most of the frame on detail-heavy files and almost nothing on flat ones; decide which operator to standardise on before running a folder.

3. Edge density swings with the source file

Non-zero pixels in an edge map are a direct count of where the operator found a boundary. Under one fixed Sobel setting the share ran from 0.556% on gray_16bit.png to 78.945% on photo_square.png; dividing the second by the first gives 142.0 (78.945 ÷ 0.556), using the two JSON density values in the table below. The three operators kept their own ordering on almost every file.

FilePixelsRobertsSobelLaplacian
photo_landscape.jpg12,000,00053.956%60.238%54.495%
photo_portrait.jpg12,000,00054.469%60.364%54.738%
photo_square.png9,000,00069.441%78.945%71.109%
duplicate_photo.jpg12,000,00054.469%60.364%54.738%
exif_orient6.jpg3,000,00052.793%58.98%54.441%
screenshot.webp1,440,00049.904%57.203%54.055%
logo_alpha.png960,0000.456%0.911%0.735%
gray_16bit.png480,0000.412%0.556%0.524%
gray_8bit.jpg12,000,00054.48%60.315%54.663%
animation.gif120,0000.417%0.833%0.83%
small_icon.png16,38469.122%69.891%67.133%

Sobel produced the highest density on every readable file. On the four flat or sparse files — the logo, the 16-bit grayscale, the GIF and the small icon — all three operators stayed below 1% except the icon, where all three crossed 67%. File content, not just file size, decides whether a batch gets a useful edge map.

Sobel edge density by file photo_square 78.945% small_icon 69.891% photo_landscape 60.238% logo_alpha 0.911% gray_16bit 0.556% animation 0.833%
Non-zero output pixels under the Sobel operator on six files, out of each file's full pixel count. Scaling is linear to 100 percent.

4. Strength clips, it does not find new edges

The strength multiplier scales the response before it is clipped to 8 bits. On photo_landscape.jpg, moving from 1.0 to 3.0 left the non-zero share pinned at 60.238% on every step, because scaling a positive magnitude cannot turn a zero into a non-zero. What changed was clipping: the count of pixels at exactly 255 climbed from 6.352% to 16.479%.

StrengthNon-zero pixelsClipped at 255Changed vs 1.0
0.557.467%1.371%7,064,096 px
1.060.238%6.352%—
1.560.238%10.023%6,466,337 px
2.060.238%12.731%6,466,337 px
3.060.238%16.479%6,466,337 px

Measured on photo_landscape.jpg with the Sobel operator. 'Changed vs 1.0' counts pixels whose 8-bit value differs from the strength 1.0 output; the 0.5 row changes values downward rather than adding edges.

Strength: clipping rises, edge count holds clipped at 1.0 6.352% clipped at 3.0 16.479% nonzero at 1.0 60.238% nonzero at 3.0 60.238%
Clipped pixels more than doubled from 6.352% to 16.479% between strength 1.0 and 3.0, while the share of non-zero pixels stayed at 60.238%. Blue bars are clipped share; grey bars are non-zero share. Scaling is linear to 100 percent.
Your call: a higher strength here brightens existing edges and pushes more of them to pure white. Whether that reads as stronger detail or as lost tonal range depends on your output; the sweep records the clipping, not the aesthetic result.

5. The threshold makes a binary map

Binarising the response replaces the grayscale with a white-or-black line map. The share of white pixels falls steadily as the threshold rises on the same landscape photo: 36.317% at 8, 24.39% at 32 and 12.699% at 128. That is a separate decision from strength and it changes far more pixels than the strength control does.

ThresholdWhite pixelsWhite share
0762,2456.352%
84,358,02836.317%
163,533,79029.448%
322,926,81224.39%
642,272,49618.937%
1281,523,87312.699%

At threshold 0 the output is the clipped grayscale itself, so the 6.352% figure counts pixels already sitting at 255. From 8 upward the map is binary. A high threshold keeps only the strongest responses, which is the nearest measured equivalent to a clean line drawing.

6. Flat regions and sparse files

An edge operator should answer zero on a region with no change. A 20 by 20 patch at the top-left corner of each photo was uniformly zero before filtering, and the Sobel response on that patch was exactly zero with zero non-zero pixels. The 16-bit grayscale is the exception: its patch ran from 0 to 255 and produced a maximum response of 876.002, which clips to a visible line even in what looks like a flat corner.

FilePatch minPatch maxMax Sobel response
photo_landscape.jpg000.0
photo_portrait.jpg000.0
photo_square.png000.0
logo_alpha.png000.0
gray_16bit.png0255876.002
small_icon.png014.0

The sparse files explain the low density in section 3. The logo started with 3 distinct gray levels and ended with 3; the GIF started with 2 and ended with 2. The 16-bit grayscale started with 256 levels at the filter stage and ended with 192. The small icon gained six levels, going from 250 to 256.

7. What happened to frames, depth and tags

Reducing each file to one grayscale channel before filtering is a lossy step for file properties, even though the filter itself is deterministic. Four properties changed across the batch.

FileBeforeAfterNote
animation.gif6 frames, indexed1 frame, grayscale PNGanimation not preserved
gray_16bit.png16-bit, 65536 levels8-bit grayscale PNGdepth reduced before filtering
exif_orient6.jpgorientation tag 6no tagtag not carried into output
logo_alpha.pngRGBA with transparencygrayscale, no alphaalpha dropped by channel conversion
Your call: if you need animation, 16-bit depth, an orientation tag or transparency in the result, this grayscale-PNG path cannot carry them. Keep the originals alongside the edge maps; whether that trade is acceptable is your decision.

8. Bytes and repeatability

Eleven grayscale PNG outputs totalled 28,897,301 bytes against 20,934,926 bytes of input, or 1.38 times the source. The spread is wide: the landscape JPEG grew from 2,403,704 to 5,512,753 bytes, while the 16-bit grayscale PNG fell from 12,042 to 583 bytes and the six-frame GIF from 5,339 to 324.

Two independent full passes over the same files produced byte-identical maps for each operator. The Sobel outputs hashed to SHA-256 181121fad31310b740390609c2505d3adc7b8edfcd0ac0d06dc5a5eb95786bad on both runs, Roberts to a72128810772e317f93b93c4841edbb7f40ccc6c24b596bbcdb4c076db71189d and Laplacian to 9a3b8b505054e17d47eb10883fba3b9b36e5445c6542d46f8c492a0e41d2eef5. Determinism here means identical bytes, not that the three operators agree with each other: on the landscape photo they differed on close to 59% of pixels.

See all measured guides

Frequently asked questions

How to detect edges in an image?

Apply a gradient or Laplacian kernel and keep the magnitude. There is no single result: on photo_landscape.jpg the Roberts and Sobel outputs differed on 7,101,949 of 12,000,000 pixels, 59.183%. Sobel and Laplacian differed on 7,079,312 pixels, 58.994%. The operator choice is the largest decision in the whole batch.

What is Sobel edge detection?

A pair of 3 by 3 kernels, one measuring horizontal change and one vertical change, combined as their magnitude. On this batch the Sobel output marked 60.238% of pixels as non-zero on photo_landscape.jpg, 78.945% on photo_square.png and 0.911% on the flat logo. The same kernel produced very different edge densities depending on the source.

What is Sobel edge detection used for?

Finding boundaries between regions. The batch shows where it has work to do: photo_square.png produced edges on 78.945% of pixels and small_icon.png on 69.891%, while gray_16bit.png produced them on 0.556% and the six-frame GIF on 0.833%. Sparse or nearly uniform files yield very few edge pixels under the same settings.

What file formats can I export?

These outputs were written as single-channel 8-bit grayscale PNGs. Every readable input, including RGB JPEG, RGBA PNG, 16-bit grayscale PNG, WebP and indexed GIF, became that same kind of file. The edge result carries no colour and no alpha layer; the transparent logo's alpha was not preserved.

Which image formats work?

In this run 11 of 12 files decoded: JPEG, PNG, WebP and GIF all opened, and a truncated JPEG failed with 'image file is truncated (2 bytes not processed)'. The GIF had six frames but its edge output reopened with one. Format support on input is not format preservation on output.

Can I download a transparent outline?

Not from this path. Each source was converted to a single grayscale channel before the kernel ran, so the RGBA logo lost its alpha and the output was saved as an 8-bit grayscale PNG. A transparency requirement needs a different output stage than the one measured here.

Does the tool support stencil and line drawing styles?

The closest measured control is the threshold. On photo_landscape.jpg, binarising the Sobel response turned 36.317% of pixels white at a threshold of 8, 24.39% at 32 and 12.699% at 128. That is a black and white line map, not a styled stencil; the measured pipeline does no style rendering.

Can I convert an image to outline for free?

This page reports a local measurement rather than operating a download service, so there is no account or usage limit to describe. The numbers come from code run on this machine over 12 files; the method and the settings are written out above so you can reproduce them. Any pricing claim belongs to a specific service, not to these measurements.

Do Roberts, Sobel and Laplacian give the same edges?

No. On photo_landscape.jpg Sobel and Roberts differed on 59.183% of pixels, Sobel and Laplacian on 58.994%. On photo_square.png the Sobel to Roberts gap was 77.324%. They agreed much more closely on sparse files: 0.556% different on gray_16bit.png and 0.42% on the GIF. Choosing an operator is not a cosmetic setting.