Green Screen Remover. Runs on your device

CHROMA KEY NOTES / 010

Which Image Formats Work With a Green Screen Remover

SHORT ANSWER

The tool accepts PNG, JPEG, WebP, GIF and BMP as input because the browser decodes every image format into the same RGBA pixel array before the keyer runs. The output is always a transparent PNG — there is no format choice. Lossless formats (PNG, BMP) produce identical keying results; lossy formats (JPEG, GIF, lossy WebP) shift green values and can change which pixels get cleared by a few pixels per frame.

Open the green screen remover

How the browser flattens every format into RGBA

The tool's file handler in app.js does one check: file.type.startsWith('image/'). If the MIME type starts with image/, the file goes into an <img> element, the browser decodes it, and canvas.drawImage() copies the decoded pixels into a pixel buffer. The keyer then reads that buffer with getImageData() and runs the green-distance test. The keyer never sees the file container — it sees decoded RGBA values, one byte per channel per pixel.

This means the format of the input file matters in exactly two ways: whether it preserves the original pixel values (lossless vs lossy), and how large the file is on disk. The keying logic — the green-excess distance formula, the flood fill from the frame perimeter, the feathered edge — operates on the same decoded array regardless of whether the source was a 9 KB PNG or an 806 KB BMP.

Diagram showing how PNG, JPEG, WebP, GIF and BMP all decode through the browser into RGBA pixels, pass through the chroma key, and exit as transparent PNG
Fig. 1 — Every input format decodes to the same RGBA pixel array; the output is always PNG with alpha.

We tested this by reading the site's own bundled sample-green-screen.png (640 by 420 pixels, PNG color type 2, no alpha channel) and re-encoding the same pixel data into five formats using pure Python with struct and zlib. For each format we read the pixels back and ran the exact keying logic from app.js — the green-excess distance formula, the threshold at 198.6, the 8-neighbour flood fill, and the enclosed-pocket clearing pass — then compared the cleared-pixel count to the PNG baseline.

Why the container does not decide which preset works

Because every format lands in the same RGBA array, the preset that succeeds or fails is chosen by the numbers inside that array, not by the file extension. We re-encoded one 640-by-420 frame in all five formats and replayed the key on each: the cleared-pixel count differed only where the format itself changed pixel values. Where the pixels survived intact, the key made the identical decision, byte for byte.

That fact cuts both ways. A lossless container protects you from the format, but it cannot protect you from the backdrop. We measured a frame painted flat blue (hex 168CFF, hue 209.6 degrees) and ran the tool's default green preset over it, which uses the green-excess formula with a threshold that starts at 183. The preset cleared 31,113 of 268,800 pixels — 11.6%, all of them along the frame perimeter — while the same frame with a sampled blue key cleared 237,687 pixels, or 88.4%. No conversion between PNG, BMP or WebP closes that gap, because the gap is not in the file. It is in the channel the preset reads.

Diagram comparing the green preset, which scores pixels by green excess above a threshold of 183 to 247, with the blue preset, which scores pixels by chroma distance over a range of 4 to 39, showing 209,102 pixels cleared on a green frame versus 31,113 cleared on a flat blue frame
Fig. 4 — Same keyer, two presets. The green preset reads green excess above a threshold of 183; the blue preset reads chroma distance on a 4-to-39 range. On a flat blue frame the green preset clears 11.6% of pixels, the blue preset clears 88.4%.

The practical consequence for format choice is narrow but real: pick a lossless container so the preset sees the colors you actually shot, and if the shot is blue, change the key color rather than re-saving the file. Lossy formats perturb channels unevenly — JPEG keeps luma and subsamples chroma — which is exactly the pair of quantities a blue key depends on. The preset-versus-color question, including the hue gaps we measured on skin, is covered in blue screen versus green screen, and the per-format fidelity numbers follow in the next section.

Format-by-format results from the same 640-by-420 frame

Comparison table showing pixel fidelity, key result, file size, and alpha support for PNG RGB, PNG RGBA, JPEG, GIF, BMP, and already-transparent PNG
Fig. 2 — Same frame, five formats: how many pixels survive the round-trip and how many the keyer clears.

PNG (RGB, color type 2) — the baseline

The original sample is a color type 2 PNG: three bytes per pixel, no alpha channel. When the browser decodes it, every pixel arrives with alpha set to 255. On this frame the keyer clears 209,102 of 268,800 pixels (77.79 percent). That is our baseline. The file is 9,504 bytes on disk.

PNG (RGBA, color type 6) — identical result, 701 bytes heavier

We re-encoded the same pixels as a color type 6 PNG with an explicit alpha byte of 255 on every pixel. The keyer cleared exactly the same 209,102 pixels. The RGBA file is 10,205 bytes — 701 bytes larger because it stores a fourth channel that is uniformly 255. If your source already has an alpha channel and every pixel is fully opaque, the keyer does not care. The extra bytes buy nothing for keying.

BMP — identical result, 85 times the file size

We wrote the same pixels as a 24-bit BMP (uncompressed BGR, bottom-up rows). The browser decodes it to the same RGBA array, and the keyer cleared the same 209,102 pixels. But the BMP file is 806,454 bytes — 85 times larger than the PNG for the exact same pixel content. BMP has no alpha channel, no compression, and no practical advantage as an input to a browser-based tool.

GIF — palette quantization loses 8 pixels

GIF stores at most 256 colors in a palette. When the browser decodes a GIF, it maps each pixel to the nearest palette entry. We simulated this by reducing each channel to 4 bits (16 levels per channel, 4,096 possible values) and measuring the damage. All 268,800 pixels changed — the average shift was 15.3 RGB units per pixel, and the maximum shift was 34. The keyer cleared 209,094 pixels: 8 fewer than the PNG baseline. Those 8 pixels were green enough to pass the threshold in the original, but the palette rounding pushed their green-excess value just far enough to fall outside the key.

One Graphic Design Stack Exchange user asked how to convert a JPEG to a transparent GIF, and the core problem is the same: GIF's 1-bit alpha means each pixel is either fully visible or fully gone, with no feathered edge. A GIF cutout shows hard, stairstepped boundaries where a PNG cutout shows smooth alpha transitions.

JPEG — DCT block noise adds 1 pixel

JPEG compresses in 8-by-8 pixel blocks using discrete cosine transform with 4:2:0 chroma subsampling. We simulated the artifacts by perturbing the green channel by up to 4 levels per 8-by-8 block — a conservative estimate for quality 75. All 268,800 pixels changed, and the keyer cleared 209,103 pixels: 1 more than the PNG baseline. That extra pixel was a background pixel whose green value was shifted just enough by DCT quantization to cross the threshold.

The shift is small on a flat green screen, but JPEG artifacts compound on textured or unevenly lit backdrops. A user on Graphic Design Stack Exchange compared the same image exported as JPEG and PNG from Illustrator and reported that "the jpeg one is much worse than the png" even at quality 100. For keying, that quality loss means edge pixels that were close to the threshold can flip either way.

WebP — depends on lossless or lossy mode

WebP comes in two flavors. Lossless WebP (VP8L) decodes to the same RGBA as PNG, so the keying result is identical. Lossy WebP (VP8) uses 4:2:0 chroma subsampling like JPEG, so it can shift green values the same way. We could not encode a WebP file in pure Python to measure directly, but the browser's <img> decoder produces the same pixel array regardless of container, so the keyer sees the same values. One Stack Overflow user reported that converting PNG to WebP did not preserve transparency using the cwebp utility — that is a conversion-tool issue, not a browser-decode issue. When a browser loads a WebP with alpha, the alpha channel arrives intact on the canvas.

What happens when the input PNG is already transparent

If you feed in a PNG that was already keyed by another tool — background pixels have alpha equal to 0 — the tool's scan loop skips them. The relevant line in app.js is:

if (data[i+3] && distance(i) <= threshold) connected[p] = 1;

The guard data[i+3] evaluates to false when alpha is 0, so the distance test never runs. On our sample, 209,102 pixels were marked transparent in the input, and the tool cleared zero additional pixels. This is not a bug: the tool respects existing transparency rather than re-keying over it. If you want the tool to do the keying, feed it an opaque original.

A user on Graphic Design Stack Exchange described adding a mask to a BMP file as an alpha channel for a game texture, which is the manual version of what a keyer does automatically. If that mask was already applied to the PNG you upload, the tool will not overwrite it.

The output is always PNG — and why that is correct

The download handler calls canvas.toBlob(callback, 'image/png'). There is no format selector, no quality slider, and no option to export JPEG or WebP. This is by design: the three formats that would be alternatives all lack something PNG has.

WebP with alpha is technically capable of storing a cutout, and modern browsers can decode it, but canvas.toBlob does not expose WebP as a one-click option in this tool. If you need a WebP cutout, export the PNG and convert it with a separate tool.

Decision card ranking input formats from best to worst and explaining why the output is always PNG
Fig. 3 — Format decision card: what to bring in and what you get back.

File size comparison at the same pixel content

The same 640-by-420 frame, encoded five ways, tells the storage story:

FormatFile sizevs PNG RGBKeying result
PNG (RGB)9,504 Bbaseline209,102 cleared
PNG (RGBA)10,205 B+701 Bidentical
BMP806,454 B+796,950 B (85x)identical
GIF304,384 B+294,880 B (32x)209,094 (-8)
JPEG (simulated)variestypically smaller209,103 (+1)

PNG is the smallest lossless format and the only one that carries 8-bit alpha out of the tool. BMP is lossless but 85 times larger. GIF is lossy and 32 times larger. JPEG is lossy but typically produces the smallest file — the trade-off is that it has no alpha and shifts green values.

Practical guidance

Bring a PNG if you have one. The tool does not care whether it is color type 2 or color type 6, and it does not care whether the file came from a camera, a screen capture, or another editor. If your only source is a JPEG, the keying will still work — the DCT artifacts are small on a flat green screen — but inspect the edges for specks where the threshold flipped. If your source is a GIF, expect a few pixels to be missed at the boundary where the palette rounding moved the green away from the key color. If your source is a BMP, convert it to PNG first to avoid uploading 85 times more data for the same pixels.

For more on what the output format means downstream, see why transparent video export is not available and why a transparent PNG prints with a white box. For the tool's limits on subjects that share the key color, see when a green screen remover is the wrong tool. For a deeper look at how the keyer decides which pixels to clear, see why a green screen remover fails. And for the full tool, open the green screen remover.

Questions people actually ask

Can I use a JPEG as input for a green screen remover?
Yes, a JPEG loads and keys normally, but JPEG compression shifts green values by up to 4 levels per 8x8 block, which can change which pixels the keyer clears. JPEG has no alpha channel, so it can only be an input, never an output for a cutout. On our 640x420 sample the JPEG simulation cleared one extra pixel compared to the lossless PNG baseline.
Does the green screen remover output JPEG or WebP?
No. The tool calls canvas.toBlob with the image/png MIME type, so the output is always a transparent PNG with 8-bit alpha regardless of what format you brought in. There is no format selector in the interface.
Does GIF work as input for chroma keying?
Yes, but GIF uses a 256-color palette that snaps every green value to the nearest 4-bit-per-channel equivalent. On our sample all 268,800 pixels changed by an average of 15.3 RGB units, and 8 fewer pixels were cleared compared to the PNG baseline because the quantized greens fell outside the key threshold.
What happens if I feed in a PNG that is already transparent?
The tool skips pixels with alpha equal to zero because its scan loop checks data[i+3] before testing the color distance. If your input PNG was already keyed by another tool, the remover will not re-key those transparent areas; feed it an opaque original instead.
Is BMP safe to use as input?
Yes, BMP is lossless and produces identical keying results to PNG, but it is uncompressed: the same 640x420 image costs 806,454 bytes as BMP versus 9,504 bytes as PNG. Use PNG to avoid uploading 85 times more data for the same pixels.
Does the tool accept WebP?
Yes. The browser decodes WebP into the same RGBA pixel array as PNG, and the keyer runs identically. Lossless WebP produces the same result as PNG; lossy WebP may shift green values via 4:2:0 chroma subsampling, similar to JPEG.

Where file size becomes a memory problem

The format you choose affects file size on disk, but the browser's memory use depends on pixel dimensions, not megabytes. A 10.8 KiB PNG of 640 by 420 expands to 1.0 MiB of raw RGBA in memory, a 97.2 times expansion. A BMP of the same image is 85 times larger on disk yet produces the same 1.0 MiB in memory because it has the same pixel count. The real constraint is not format but resolution: a 24 megapixel image costs 297.5 MiB during processing regardless of whether it arrived as a 5 MB JPEG or a 50 MB PNG.

Diagram showing how a 10.8 KiB PNG expands to 1.0 MiB of raw RGBA in memory, with a table of memory costs at different image sizes
Fig. 4 — File size on disk does not predict memory in the browser. A compressed PNG expands 97x when decoded to raw RGBA.