Every threshold level from 32 to 224 changed exactly 42,995,243 pixels of the batch, 68.229%, because a two-value output changes any pixel that was not already pure black or pure white. What the slider actually decides is how that 68% splits — on photo_landscape.jpg the white share fell from 64.660% at level 32 to 2.583% at level 224, while 35.340% of the frame stayed black the whole way.
So the number you pick never governs how much of the image changes. It governs which of the two values each pixel lands on. A pixel-count audit cannot tell you which level ran; the white-to-black split can.
This page treats thresholding as a batch operation: one level, a folder of mixed files, and a per-file account of the output. The neighbouring measurements on the same twelve files are the batch gamma measurement (a curved lift that keeps grays), the batch equalize measurement, the batch grayscale measurement (grays kept, colour gone) and the batch invert measurement. If you want the single-image case, start at the photo flipper.
Gamma and threshold are worth comparing directly because both are one-number controls. Gamma moves every value and never reaches black or white by accident; threshold keeps only the two ends and throws the middle away on purpose. On the transparent logo the same folder gave 53.46% changed under gamma 2.2 and 53.46% changed under a threshold of 128, yet the alpha channel behaved differently at the edges, as section 6 shows.
Twelve files, 20,933,726 bytes on disk and 63,016,384 pixels across the 11 that decoded. Each readable file was converted to RGBA, the three colour channels were averaged into one luma value per pixel, that value was compared with the level, and the pixel was written as 255 if it was at or above the level and 0 if it was below. The comparison is inclusive: a pixel exactly at the level goes white.
Seven settings, one count. That is not a bug in the measurement, it is arithmetic: on a frame with no pure black and no pure white, a threshold changes every single pixel no matter where the cut falls, so the count can only be the whole frame. It happens to be 68.229% here because 31.771% of these frames are already at 0 or 255.
| Level | Pixels changed | Share of batch | Pure white | Pure black |
|---|---|---|---|---|
| 32 | 42,995,243 | 68.229% | 67.701% | 32.299% |
| 64 | 42,995,243 | 68.229% | 59.735% | 40.265% |
| 96 | 42,995,243 | 68.229% | 52.096% | 47.904% |
| 128 | 42,995,243 | 68.229% | 42.697% | 57.303% |
| 160 | 42,995,243 | 68.229% | 31.347% | 68.653% |
| 192 | 42,995,243 | 68.229% | 15.454% | 84.546% |
| 224 | 42,995,243 | 68.229% | 3.735% | 96.265% |
Shares are of the 63,016,384-pixel batch, readable files only. The changed count is identical at all seven levels: 42,995,243 divided by 63,016,384 equals 68.229%. White plus black equals 100% at every row because the output holds only those two values.
Between level 32 and level 224 there is a band of pixels that does move: on the landscape photo, 7,449,145 pixels, 62.076% of the frame, flipped from white to black as the level rose. The other 37.924% did not move at all, because 309,996 were at 255 in both runs and 4,240,859 were at 0 before the first run started.
| File | Pixels | White to black, 32→224 | Share | Never moved |
|---|---|---|---|---|
| photo_square.png | 9,000,000 | 7,444,671 | 82.719% | 17.281% |
| small_icon.png | 16,384 | 10,547 | 64.374% | 35.626% |
| screenshot.webp | 1,440,000 | 906,230 | 62.933% | 37.067% |
| exif_orient6.jpg | 3,000,000 | 1,870,915 | 62.364% | 37.636% |
| photo_landscape.jpg | 12,000,000 | 7,449,145 | 62.076% | 37.924% |
| gray_8bit.jpg | 12,000,000 | 7,367,736 | 61.398% | 38.602% |
| logo_alpha.png | 960,000 | 352,420 | 36.71% | 63.29% |
| animation.gif | 120,000 | 10,000 | 8.333% | 91.667% |
| gray_16bit.png | 480,000 | 1,406 | 0.293% | 99.707% |
White to black counts pixels that were 255 at level 32 and 0 at level 224. Never moved counts pixels at 255 in both runs plus pixels at 0 in both. The thirteen-row maths: the two byte-identical portrait JPEGs are omitted here because they repeat the same row, 7,447,749 white to black and 37.935% never moved.
A level only reaches the pixels whose luma sits in the band between the lowest and highest setting you try. On the landscape photo, 50.524% of pixels are below luma 96 and 30.197% are at or above 160, which leaves 19.278% in the band that a sweep from 96 to 160 actually touches. The rest of the range is decoration.
| File | Below luma 96 | Luma 96 to 159 | Luma 160 and up |
|---|---|---|---|
| photo_landscape.jpg | 50.524% | 19.278% | 30.197% |
| photo_square.png | 34.025% | 25.747% | 40.228% |
| screenshot.webp | 49.631% | 20.719% | 29.65% |
This is the number to look at before dragging a slider across a folder. If almost nothing sits in the middle band, the slider will look dead until it suddenly flips half the frame, and no amount of fine adjustment will fix it. If a lot sits in the band, small steps matter and the difference between 128 and 132 is visible.
A threshold needs one brightness per pixel, and a colour pixel has three values. Averaging the three equally, or weighting green heavily the way video standards do, gives different answers near the cut. On the square PNG the difference between an equal-weight mean and the classic 0.299 / 0.587 / 0.114 weighting put 666,434 pixels, 7.405% of the frame, on opposite sides of level 128.
| File | Equal weights, white | 0.299/0.587/0.114, white | 0.2126/0.7152/0.0722, white | Equal vs 0.299 disagreement |
|---|---|---|---|---|
| photo_square.png | 55.309% | 49.511% | 55.711% | 666,434 (7.405%) |
| photo_landscape.jpg | 41.497% | 37.138% | 41.781% | 662,952 (5.525%) |
| screenshot.webp | 41.715% | 37.421% | 42.102% | 82,291 (5.715%) |
| logo_alpha.png | 16.75% | 16.75% | 16.75% | 0 (0.0%) |
White share at level 128 under three luma definitions. Disagreement counts pixels where one definition classifies the pixel above the level and the other below. The logo is flat black and white already, so no definition can disagree about it.
This is not a detail you can average away. Every pixel whose equal-weight luma falls in the narrow gap between the two formulas can switch sides at the same level, and the gap scales with how saturated the pixel is. A skin tone or a dusk sky sits exactly where the two definitions disagree, so two tools can produce visibly different black shapes from the same file at the same level.
The transparent logo has 607,580 fully transparent pixels, 63.29% of the frame. Their alpha bytes were identical before and after the threshold, so the file still has its cut-out shape. What changed is the colour stored in those invisible pixels: 160,800 of them now hold pure white and 446,780 hold pure black.
| File | Transparent pixels | Turned white | Turned black | Alpha bytes |
|---|---|---|---|---|
| logo_alpha.png | 607,580 (63.29%) | 160,800 | 446,780 | identical |
| animation.gif | 0 | 0 | 0 | identical |
That matters the moment someone reopens the file with a different background, or a downstream tool composites it on white. The visible edge was governed by alpha, which did not move; the fringe was governed by the colour, which did. If you threshold a cut-out for print, compare the edge against its final background rather than against the checkerboard.
A threshold writes a two-value image, and a two-value image fits into formats that a grayscale one does not always survive. The container is where most of the surprises are.
| File | Before | After | Note |
|---|---|---|---|
| animation.gif | 6 frames, indexed | 1 frame | Reopening the saved GIF gave one frame |
| gray_16bit.png | 16-bit, 65,536 levels, 0 to 65,535 | 8-bit, 256 levels | raw samples 0 to 65,535 became 256 distinct values after conversion to RGB |
| exif_orient6.jpg | orientation tag 6 | no tag | 2000 x 1500 dimensions unchanged, tag dropped |
| logo_alpha.png | RGBA, 63.29% transparent | RGBA, same alpha | colour under transparency replaced |
The 16-bit file is the one that behaves least like a photo. Its samples ran the full 0 to 65,535, but after conversion to 8-bit RGB only 256 values remained, and 99.805% of the frame sat above level 128. A threshold on this file at any level from 32 to 224 produced a nearly white output: 99.951% white at 32, still 99.658% at 224. That is not the tool failing, it is a bright 16-bit scan meeting a cut designed for 8-bit photos.
A two-value image compresses hard. Eleven files at level 128 wrote 2,576,292 bytes of PNG from 20,933,726 bytes of input, 0.1231 times the source. The size depends on which level you chose, because the boundary between black and white is where all the bits go: 621,401 bytes at level 32, 2,576,292 at 128 and 1,446,204 at 224.
| File | Input bytes | Output at 32 | Output at 128 | Output at 224 |
|---|---|---|---|---|
| photo_landscape.jpg | 2,403,704 | 120,569 | 480,364 | 255,598 |
| photo_square.png | 10,636,840 | 92,703 | 440,561 | 237,400 |
| photo_portrait.jpg | 2,443,475 | 114,923 | 469,342 | 260,456 |
| gray_8bit.jpg | 2,068,147 | 109,564 | 492,971 | 311,937 |
| screenshot.webp | 186,788 | 18,346 | 70,001 | 33,089 |
| small_icon.png | 22,214 | 510 | 1,471 | 589 |
All outputs were written as 8-bit RGBA PNG. The totals are 2,576,292 bytes at level 128 against 20,933,726 bytes of input across the same eleven files; 2,576,292 divided by 20,933,726 equals 0.1231. The portrait row is repeated for its byte-identical twin and counted once in the total.
Blurring before the cut changes the cost in a way the level alone does not. A one-pixel gaussian blur then a threshold of 128 moved only 1.814% of the landscape frame compared with a hard cut, 2.973% of the screenshot and 4.401% of the small icon. The white share barely shifted: 41.512% to 41.58% on the landscape, 41.638% to 40.192% on the icon. What the blur buys is a softer edge, not a different image.
Two independent passes at level 128 produced byte-identical output: 2,576,292 bytes both times, SHA-256 1bd5cf14fb0979a0ca9baf8bb601404f990ef702c4d93c47848f20a9f56854d4 over the eleven PNG files in order. The first pass took 6.15 seconds and the second 6.19 seconds of wall clock for the folder. Treat those as scale, not as a benchmark.
Pick one level between 0 and 255 and apply it to every file at once. On this batch a level of 32 turned 64.660% of a 4000 x 3000 landscape JPEG pure white and 35.340% pure black; the same 32 turned 86.217% of a square PNG white. No pixel keeps a middle value, which is what separates a threshold from a black and white conversion.
Binarizing and thresholding are the same operation: every output sample becomes either 0 or 255. This batch wrote 11 files at 2,576,292 bytes of PNG from 20,933,726 bytes of input, 0.1231 times the source, because the deep grays are for the first time encoded once instead of 256 times.
A black and white conversion keeps the grays and removes the colour. A threshold removes the grays too. The test is in the output: after thresholding there are exactly two values, 0 and 255, and the changed-pixel count on photo_landscape.jpg was 7,922,051 at level 32 and the same 7,922,051 at level 224, a difference of zero.
There is no universal number. Across this batch level 128 left 57.303% of all pixels black and 42.697% white, while the same level on the 16-bit grayscale file produced 99.805% white. Watch the white share rather than the slider: it moved from 64.660% to 2.583% on the landscape photo between level 32 and level 224.
Because one level is applied to the whole frame, and a shadowed corner can sit below it. On the screenshot file the pixels between luma 96 and 159 were 20.719% of the frame, and those are the only ones a level sweep can move; everything at or below 96 stayed black at every setting from 32 to 224.
That depends on the tool, not on the operation. The measurements on this page ran on 12 local files that never left the machine: Pillow 13.0.0 and numpy 2.5.4 read them from disk and wrote PNG output to disk. Whether a browser tool uploads is a separate question you can answer only by reading that tool's own page.
The alpha bytes can survive untouched while the colour under them does not. On the transparent logo, 607,580 pixels were fully transparent and their alpha bytes were identical before and after; 160,800 of those transparent pixels were still assigned pure white, so the file now carries white data in places nothing can see.
It runs, but one level rarely suits a mixed folder. The same level 128 changed 87.532% of a square PNG and 0.388% of a 16-bit grayscale file, and 8.333% of a six-frame GIF whose darkest frame values never reached 128 at all. Sort by brightness before you pick the number, because the number is global.
No. All seven levels from 32 to 224 changed 42,995,243 of 63,016,384 pixels, 68.229%, because any pixel that is not already pure black or pure white gets rewritten whichever side of the cut it lands on. What changes is the split: the batch went from 67.701% white at level 32 to 3.735% at level 224.
It is squeezed to 256 levels before the cut is applied. This file carried 65,536 distinct sample values from 0 to 65,535, and after conversion to 8-bit RGB only 256 remained; 99.805% of the frame sat above level 128, so every level from 32 to 224 produced a nearly white result. Convert at the bit depth you intend to keep, not after.