In one line: when you black out part of a lossy-compressed image, information can survive outside the box. JPEG has a locality guarantee ("leave an 8px margin — 16px with chroma subsampling — and nothing leaks past the box"); lossy WebP (VP8) does not. So redact the uncompressed original and export losslessly.

Why this, why now

The problem

The typical flow looks like this:

  1. The source image (a screenshot, a photo of a document) has already been saved in a lossy format (say WebP at q50).
  2. You decode it and paint a black rectangle over the secret part.
  3. You save the result in a lossless format (PNG) and share it.

It is tempting to think "I saved it as PNG, nothing degraded, and what was under the box is gone". The problem is step 1. A lossy encoder looks at the whole image to decide how to spend a limited number of bits, so the secret pixels influenced how error was distributed in the pixels outside the box. If an attacker can enumerate candidates (YES or NO, a four-digit number, ...), replay the same pipeline, and pick the candidate whose artifacts outside the box match best, they can infer what was hidden.

This is not an X-ray that peels off redactions. As kornel notes, it only works when the attacker can reproduce the original quite precisely (fonts, layout, background) and can enumerate candidates. Screenshots, though, tend to meet exactly those conditions, since you can re-render the same text with the same OS and fonts. It is the same structure that let tools like Depix defeat pixelation and blur by rendering candidates and comparing them.

How it works

JPEG: why the influence stays within 8×8 (or 16×16)

Baseline JPEG cuts the image into 8×8 blocks and applies a DCT and quantization to each block independently. The quantization table is fixed for the whole image (set by the quality setting), so the quantization error of a block depends only on that block's pixels. DC coefficients are coded as differences from the previous block, but that happens in the lossless entropy-coding stage and does not affect reconstructed pixels.

So the reconstruction of a block that contains none of the secret pixels does not depend on the secret. If you extend the black box to cover every block that might contain secret pixels (in practice, "an 8px margin"), nothing remains outside it.

There is a catch. With chroma subsampling (4:2:0), the chroma planes are halved in both directions before being split into 8×8 blocks, so one chroma block covers 16×16 pixels of the original. On top of that, the decoder's interpolating upsampler mixes neighbouring samples. So for a 4:2:0 JPEG, 8px is sometimes not enough.

Lossy WebP (VP8 key frame): two reasons locality breaks

Lossy WebP is VP8 video key-frame (intra-frame) coding. Unlike JPEG, it has:

  1. Intra prediction: each macroblock (16×16 luma, 4×4 luma sub-blocks, 8×8 chroma) is predicted from the already-reconstructed row above and column to the left (H_PRED / V_PRED / DC_PRED / TM_PRED and others). Only the difference from the prediction (the residual) is sent. The reconstruction is "prediction + quantized residual", so the reconstruction error of a block that contains the secret changes the prediction of the blocks to its right and below, which changes how their residuals get quantized, which changes the blocks to their right and below, and so on.