GreenBG Remover

Why do pixels at the edge end up half green and half foreground?

Because a pixel is an area, not a point. Any sensor cell sitting on the boundary of your subject collects light from the subject and from the screen at the same time, and records exactly one blended colour: the subject colour times the fraction it covers, plus the key colour times the rest. The keyer only ever sees that blend, so it has to infer the fraction back out, and the only measurement available is proportional to it. That one relationship explains why a white shirt keeps detail down to 13.5 percent coverage while denim loses anything under 34.0 percent, and why a half-covered denim edge comes back at alpha 0.771 instead of a full 1.

A pixel has width

The intuition most people carry is that a photograph is a grid of points, and every point belongs to either the subject or the background. It is not. Each cell in the sensor is a small bucket with real area, and it integrates whatever light lands on the whole bucket.

Put a sharp edge across that bucket — a shoulder, a strand of hair, the rim of a hat — and the bucket fills with part subject and part screen. It cannot report two colours. It reports one, and that one colour is the average:

C = F x a + G x (1 - a)

where F is the subject colour, G is the screen colour, and a is the fraction of the cell the subject covers. At a = 1 you have a pure subject pixel. At a = 0 a pure screen pixel. Everything interesting lives in between, and in a 1080p frame there are a lot of pixels in between.

This is not a flaw in the camera. It is how sampling works, and no amount of resolution removes it — higher resolution makes the band narrower in relative terms, but the band is still there, one pixel wide, all the way around your subject.

What the keyer can actually measure

Now the awkward part. The keyer receives C and nothing else. It does not know F, and it does not know a. It has to recover the coverage from a single colour.

The trick that makes this work is that the blend is linear, so the distance from the blend to the key colour is also linear in the coverage:

d(C, G) = a x d(F, G)

Measure how far C sits from the screen colour in normalised RGB, and you have a reading proportional to how much subject is in that cell — scaled by how far the subject colour itself sits from the screen. That scaling factor is the whole problem, because it is different for every colour you wear.

The keyer then maps that distance onto an alpha through a window. On this tool the default window is [0.161, 0.259]: anything closer than 0.161 to the key colour is thrown away entirely, anything further than 0.259 is kept entirely, and the range between becomes the semi-transparent edge. Those two numbers are measured, not chosen for this article.

The coverage each colour needs to survive

Rearranging the relation above gives the number that actually matters to you: the coverage at which a pixel stops being deleted, and the coverage at which it is finally kept in full.

Read that as a ranking of how forgiving your subject is. A white shirt keeps a strand that covers one pixel in seven. Denim needs that strand to cover more than a third of the cell before the keyer will admit it exists. Same shot, same lighting, same settings — a factor of 2.5 in how much fine detail survives, decided entirely by the colour of the fabric.

Why denim is the worst case on screen

One colour in that list behaves differently from the rest, and it is worth isolating.

At exactly half coverage, eight of the nine colours above come back at full alpha — once half the cell is subject, the distance is already past the top of the window and the pixel is opaque. Denim does not. Its half-covered pixel measures 0.237 from the key colour, which lands inside the window, so it returns alpha 0.771 instead of 1.

That missing 0.229 is not visible as a hole. It is visible as an edge that looks slightly soft, slightly see-through, slightly wrong when you put the subject on a new background — and it is worst exactly where denim usually is, along the outside of a leg or an arm.

The reason is simple geometry. Denim blue #3B5C7E sits 0.473 from the key colour, which is the shortest distance of anything tested — roughly half what light skin manages at 1.000. Short distance means small signal, and small signal means the keyer cannot tell the difference between a cell that is genuinely half denim and a cell that is nearly all screen.

How green the blend actually is

There is a second consequence that has nothing to do with alpha. The blend is green, because the screen contributed half of it, and if you output that pixel unchanged you get a green rim.

Here is how far the half-covered pixel lands from the colour it was supposed to be, in CIE76 dE:

Every one of those is a large colour error, and the worst is red. Red is roughly opposite green, so mixing them drags the hue a long way — which is why a red garment on a green screen produces the most obvious fringe even though red itself is nowhere near the key colour in distance terms.

The interesting case is blonde hair at 41.72, the smallest error in the list. It is smallest precisely because blonde is already close to green in hue, so blending in green moves it less. That sounds like good news and it is not: the same closeness is what makes blonde hair hard to separate in the first place.

Can you tune your way out of it

Partly, and the trade is worth seeing before you reach for the slider.

Narrowing the key window by lowering similarity moves the top of the window down, so the half-covered denim pixel at 0.237 clears it and comes back fully opaque. At similarity 36, denim is fine. At 30 and 24 it stays fine.

The cost is at the other end of the window. Lowering similarity also lowers the threshold below which a pixel is deleted outright, from 0.161 down to 0.131, 0.101 and 0.071 as you keep going. More pixels that should have been thrown away survive as partial transparency, which is a green haze around the whole subject rather than a clean cut.

So the honest summary is that you can trade edge thinning for haze, in either direction, and neither end is free. The width of the semi-transparent band itself — 0.098 at default — is set by smoothness, not by similarity, which is why raising smoothness gives you a softer edge without moving where the cut falls.

What this means when you shoot

Three things follow directly from the arithmetic above.

Colour is a settings decision. If you can choose what the subject wears, you are choosing how much fine detail survives. White and light skin are forgiving at 13.5 and 16.1 percent; denim costs you a factor of 2.5 against them.

Backlight the hair, not the screen. The blend is caused by the screen contributing light to a cell that is mostly subject. Separating the subject from the screen and lighting them independently reduces how much screen light wraps onto the edge in the first place, which no amount of keyer tuning can undo after the fact.

Expect the edge to be one pixel wide and always wrong. It is a mixture by construction. The job of spill suppression is to fix the colour of that band, and the job of a choker is to decide how much of it to keep — neither can recover information the blend already destroyed.

Related questions

Why is a half-covered pixel green instead of half green?

Because the sensor cell integrates all the light landing on it and reports one average. Half subject and half screen produces the arithmetic mean of the two colours, which is a single green leaning colour, not two colours side by side.

Can a higher resolution camera fix the green edge?

Not remove it, only narrow it. The blended band is always about one pixel wide, so more pixels means a smaller fraction of the frame is blended, but the band still exists all the way around the subject.

Why does denim lose more edge detail than a white shirt?

Because coverage is inferred from distance to the key colour, and denim blue #3B5C7E sits 0.473 from key green while a white shirt sits 1.193. The smaller signal means denim must cover 34.0 percent of a cell to survive, against 13.5 percent for the shirt.

Does lowering similarity always help?

It protects edges — denim stops thinning at similarity 36 — but it also lowers the discard threshold from 0.161 to 0.131 and below, so more screen survives as partial transparency. You trade edge thinning for green haze.

Why does red fringe so badly on a green screen?

Because red is nearly opposite green in hue, so a 50/50 blend lands 72.00 dE away from the original red, the largest colour error of the nine colours tested — even though red is far from the key colour in distance and separates cleanly.

Open the green screen remover