Short answer: key the frame at 3840×2160, then downscale with premultiplied alpha. A plain straight-alpha resize averages the green that is still stored in transparent pixels into the subject edge: on one test frame a 2× Lanczos downscale left 3,493 of 11,564 edge pixels more than 20 green levels off, while premultiplying first left none. Keying after the downscale deleted 3,416 soft edge pixels.
What a resize does to a keyed frame
A keyer changes alpha, not colour. The pixels it makes transparent keep the RGB they had — usually the green backdrop — because a straight-alpha PNG stores colour and coverage separately. That is harmless until a resizer touches the file. A resizer averages the RGB of neighbouring pixels without asking whether those pixels are visible, so the green from fully transparent pixels is mixed into the RGB of the edge.
The arithmetic is short. Take a pixel on a two-colour edge, with true coverage a, subject colour S and backdrop colour G. A correct premultiplied resize produces aS + (1−a)G for colour and a for alpha, and compositing over a background B gives aS + (1−a)B. A straight resize averages colour first, so alpha is applied twice:
wrong = a²S + a(1−a)G + (1−a)B
error = wrong − correct = a(1−a)(G − S)
The error peaks at a = 0.5 and scales with how far the backdrop is from the subject. For black hair #1b1b1b against #00b140, the vector is (−27, +150, +37), so half coverage adds about 37 green levels and leaves a 28-level green surplus over the brighter of red and blue. For skin #d9a07a the vector is (−217, +17, −58): the edge loses red and blue, which reads as a green-cyan cast even though the green channel barely moves. The measured maximum on the full frame was 45.2 levels with bilinear and 47.8 with Lanczos, because real edges mix three materials and Lanczos adds ringing.
Formula is for a straight-alpha resize with a box filter. Bilinear and Lanczos change the weights and add overshoot; they do not change the sign or the cause.
The test frame and the three paths
I rendered one 3840×2160 frame with a known coverage matte: skin, a white shirt, a green shirt, navy fabric, a hair cap and 38 thin strands 2.2–4.8 px wide at 4K. Edges are antialiased analytically, so every pixel has a true alpha before any key runs. The key is the exact formula used by the browser keyer on this site: sRGB distance from the sampled colour divided by 441.6729559, alpha 0 below tolerance, a linear ramp across softness, 255 above.
| Test parameter | Value |
|---|---|
| Frame | 3840×2160, 8,294,400 pixels, analytic 1 px edges |
| Backdrop / key | #00b140 |
| Key settings | 22% tolerance, 3% softness (site default) |
| Edge band measured | 11,564 pixels with true alpha between 0.02 and 0.98 |
| Resizer | FFmpeg 9.0.2 scale, bilinear and Lanczos, 4K to 1920×1080 and 1280×720 |
Three paths were compared against the same known matte. A: key at 4K, keep straight alpha, resize. B: key at 4K, premultiply, resize, composite. C: resize the source RGB first, then key at the smaller size. Path A is what happens when a keyed PNG is dropped into a tool that resizes straight alpha. Path B is the fix. Path C is the other common order, and it has a separate cost.
The halo, measured
Green excess here means the composited green channel minus the larger of red and blue, on a white background, sampled only inside the true edge band. A value of zero is a neutral edge. Twenty levels is roughly the point where a fringe becomes visible at 100% on a light background.
| Resize path | Edge pixels | Green excess over 20 | Share of edge | Max excess |
|---|---|---|---|---|
| Straight alpha, bilinear, 2× | 11,564 | 4,910 | 42.46% | 45.2 |
| Straight alpha, Lanczos, 2× | 11,564 | 3,493 | 30.21% | 47.8 |
| Premultiplied, Lanczos, 2× | 11,564 | 0 | 0.00% | 16.0 |
| Straight alpha, Lanczos, 3× (to 720p) | 7,713 | 3,219 | 41.73% | 36.9 |
| Premultiplied, Lanczos, 3× (to 720p) | 7,713 | 0 | 0.00% | 13.2 |
One frame, one synthetic subject. The exact counts depend on edge length and hair density; the direction does not. The premultiplied rows are not perfectly zero by construction: a 16-level maximum remains at a few pixels because Lanczos can overshoot the alpha plane too.
Notice that the 3× downscale is not worse per edge pixel than the 2× — 41.73% against 30.21% for Lanczos, but the edge band itself is smaller and its pixels are more mixed. The useful number is not the maximum error, which is similar; it is how many visible pixels carry it. At 2×, roughly one in three edge pixels is over the threshold. At 3×, two in five are.
The matte cost of resizing first
The colour halo is only half the story. If the source is resized before the key, the key sees an edge pixel that is already an average of subject and backdrop. The threshold is nonlinear: a 1080 pixel that is half skin and half green sits about 25.5% from the key, which is above the 22% tolerance, so it becomes fully opaque. A 1080 pixel that is half black hair and half green sits at 17.75%, below 22%, so it becomes fully transparent. A soft 4K edge turns into a hard 1080 edge, and a thin strand can disappear entirely.
| Order | Mean alpha error vs truth | RMSE | Soft pixels deleted | Soft pixels forced opaque |
|---|---|---|---|---|
| Key 4K, then downscale 2× | 24.0 | 29.0 | 90 | 0 |
| Downscale source, then key 2× | 59.5 | 73.2 | 3,416 | 759 |
| Key 4K, then downscale 3× | 13.9 | 17.0 | 1 | 0 |
Alpha error is in 0–255 levels, measured only where true alpha is between 0.02 and 0.98. “Deleted” means true alpha above 0.25 but keyed alpha below 20; “forced opaque” means true alpha below 0.75 but keyed alpha above 247. The 3× row is closer to truth than the 2× row because its edge band contains fewer, more thoroughly mixed pixels — not because a bigger reduction is better for detail.
The hair band makes the difference easier to see. In the top third of the frame, 9,852 true edge pixels remain. Keying at 4K and then downscaling missed them by 24.5 levels on average and deleted 89. Downscaling first and keying at 1080 missed by 60.0 levels and deleted 3,131 — nearly a third of the hair edge. The matte that survives at 1080 is harder and thinner, which is why a downscaled key looks sharp in a still and crawls in motion.
The fix: premultiply, resize, unpremultiply
Premultiplying multiplies RGB by alpha before the resize, so a fully transparent pixel contributes zero colour instead of a full-strength green. The resize then averages only the light that was actually visible. Unpremultiply converts the result back to the straight-alpha convention that PNG and most editors expect. The alpha plane is copied through untouched.
This exact command was run on the 4K test frame with FFmpeg 9.0.2. Note inplace=1: without it, this build expects a second input stream to supply the alpha plane and fails with “expected to have exactly 1 input”.
ffmpeg -i keyed-4k.png -vf "premultiply=inplace=1,scale=1920:1080:flags=lanczos,unpremultiply=inplace=1" keyed-1080.png
| Command output check | Straight resize | Premultiplied command |
|---|---|---|
| Edge pixels with green excess over 20 | 3,493 | 12 |
| Share of the 11,564-pixel edge band | 30.21% | 0.10% |
| Max green excess | 47.8 | 23.7 |
| Alpha changed by the premultiply round-trip | — | 0 of 8,294,400 pixels |
The residual 12 pixels are Lanczos ringing at the hardest hair/white transitions, not unmixed green. A manual premultiplied box resize on the same frame produced 0 pixels over 20 and a 16-level maximum. The round-trip check compared the 4K alpha plane before premultiplying and after unpremultiplying: maximum delta 0.
For video, the same chain works inside a filter graph as long as the codec keeps alpha. I ran a three-frame 3840×2160 to 1920×1080 test through it with ProRes 4444: the output reported yuva444p12le, 3 frames, and the decoded alpha plane still separated 1,722,930 fully transparent pixels from 84,113 fully opaque ones. The tables above measure the still path; the video path was checked for alpha survival, not for the same per-pixel counts.
ffmpeg -i keyed-4k.mov -vf "premultiply=inplace=1,scale=1920:1080:flags=lanczos,unpremultiply=inplace=1,format=yuva444p10le" -c:v prores_ks -profile:v 4 keyed-1080.mov
What the browser keyer can and cannot do here
The keyer on this site is a still-frame tool and it caps the working image at 1400 px on the long edge. A 3840×2160 frame is reduced to 1400×788 before the key runs — 13.3% of the original pixels. That is enough to judge a tolerance, a sample point and a spill edge, and it is the right place to try settings before committing a whole clip. It is not a 4K key and this page will not pretend otherwise.
The practical split is: use the browser tool on a 1400 px proxy to choose the key colour and the two sliders, then run the full-size key in FFmpeg or an editor and premultiply before any downscale. If the deliverable is a 1400 px PNG, the browser export is already at its final size and the problem in this page does not arise; the halo appears when a larger keyed frame is reduced afterwards.
The same limit is why an editor's “scale to fit” can look clean in the preview and dirty after export: the preview may composite premultiplied while the export writes straight alpha, or the other way round. The check is always the same file on two backgrounds, at 100%, after the resize.
Check before you export
- Put the resized result on white and on black. A green fringe that appears on white but not on black is a colour error in the edge, not a hole in the matte.
- Zoom to 100%, not fit-to-window. A 2 px fringe at 4K becomes sub-pixel at 30% zoom.
- Look at one thin strand end to end. If it is thinner than the 4K version, the source was resized before the key.
- If the edge is dark rather than green, you premultiplied twice or unpremultiplied a file that was already straight. Dark edges are the opposite failure.
- Compare the alpha plane before and after the premultiply round-trip. It should be identical, not merely similar.
Green screen remover 4K FAQ
Why does my keyed 4K clip get a green halo only after I resize it to 1080p?
Because the transparent pixels in a straight-alpha file still contain the backdrop colour, and the resizer averages colour without weighting it by alpha. On the measured frame, a 2× Lanczos downscale put 3,493 of 11,564 edge pixels more than 20 green levels off; premultiplying before the resize left 12. The halo is created by the resize, not by the key: the same 4K matte is clean at full size.
Should I key before or after downscaling?
Key first, at full resolution, then downscale the matte. On the same frame, keying at 4K and downscaling missed the true alpha by 24.0 levels on average and deleted 90 soft pixels; resizing the source first and keying at 1080 missed by 59.5 levels and deleted 3,416. In the hair band alone the deleted count was 89 against 3,131. The reason is that the key is a threshold, and averaging colour before a threshold turns a soft edge into a hard one.
Does the browser green screen remover handle 4K?
No. It keys a still frame at up to 1400 px on the long edge, so a 3840×2160 input becomes 1400×788 — 13.3% of the original pixels. Use it to test the sample colour, tolerance and softness on that proxy, then key the full-size frame in FFmpeg or an editor. The tool page states the same cap; there is no hidden 4K path.
How do I know whether a PNG is premultiplied?
There is no reliable flag in a plain PNG. The practical test is a hard edge over a contrasting background: if the file is straight alpha, the RGB under fully transparent pixels usually still holds the old backdrop colour (green, in a keyed frame); if it is premultiplied, those pixels are black or near black. The ambiguity is old and common enough that it has its own Stack Overflow question, How do I know if an image is premultiplied alpha?. When in doubt, premultiply explicitly before the resize and unpremultiply after it; doing that once is safe, doing it twice darkens the edge.
Can despill or a higher tolerance remove the halo after resizing?
No. The halo is in the RGB of pixels whose alpha has already been averaged; despill can neutralise the colour, but it also darkens the edge, and it cannot restore the coverage that the resize mixed away. Raising tolerance deletes more of the subject before the resize and does nothing to the colour averaging that happens afterwards. The order is the fix: premultiply, resize, unpremultiply, then despill only if the original key left spill on the subject.
What about 4K to 720p?
The same failure, with a wider band. A 3× Lanczos downscale put 3,219 of 7,713 edge pixels over 20 green levels (41.73%); the premultiplied version put none over 20 and peaked at 13.2. The per-pixel maximum is similar to the 2× case because the error is bounded by the colour difference, not by the scale factor. What grows is the number of pixels that carry the error.
Next step
If you are still choosing the key, start with the browser green screen remover on a 1400 px frame, then take the settings to the full-size pass. For the per-frame video path, see green screen remover for video; for the alpha check after export, see the edge checker.