⏱️ Reading time: 6 min

Painting a black rectangle over an image before sharing it doesn’t guarantee that the covered data disappears from the file. Thomas Karpiniec, author of the blog Serious Computer Business, tested what happens when you redact lossy WebP images and compared the result with JPEG: he found that WebP doesn’t offer the same safety margin JPEG does (source).

📑 En este artículo
  1. JPEG Contains Redaction Damage Within 8-Pixel Blocks
  2. Why Redacting WebP Images Isn’t the Same as JPEG
  3. What This Means If You Redact Screenshots at Work
  4. If You’ve Already Shared a Redacted WebP Screenshot
  5. Which Format to Use for Redaction: JPEG, WebP and PNG
  6. What the Experiment Still Doesn’t Answer
  7. Frequently Asked Questions
    1. Is PNG always safe for redaction?
    2. How do I know if a screenshot already went through lossy WebP?
    3. Does this also apply to video frames?
  8. References

JPEG Contains Redaction Damage Within 8-Pixel Blocks

JPEG splits an image into independent 8×8-pixel blocks and applies a discrete cosine transform to each one separately, as defined in the ITU-T T.81 specification. That independence has a practical consequence for anyone redacting an image: the lossy compression error in one block doesn’t leak into neighboring blocks, it stays contained.

Karpiniec tested this with a simple experiment. He saved an image with the word “YES” at quality 50, covered the text with a black box that leaves only 2 pixels of margin beyond the letters, and saved the result again as lossless PNG (source). He repeated the same process with a version of the image that said “NO” in the same spot. Subtracting the pixels of both versions and amplifying the difference 20 times, the artifact pattern stays confined to a ring around the box, exactly what 8×8 block theory predicts. That’s where the classic recommendation comes from: leaving at least 8 pixels of margin around sensitive content is enough to keep JPEG from leaking anything.

JPEG limits redaction damage to a single 8×8-pixel block, per ITU-T T.81. Foto de National Cancer Institute en Unsplash

Why Redacting WebP Images Isn’t the Same as JPEG

Karpiniec repeated the same experiment with lossy WebP (the VP8 codec) and the result changed completely. The difference between the “YES” version and the “NO” version shows up across the entire image, not just near the box (source). There’s no safety margin equivalent to JPEG’s 8 pixels: in his own words, “there’s no obvious way to apply the redaction that avoids the leak.”

The original article doesn’t explain the mechanism, but it’s in the format’s specification. RFC 6386, the document that defines VP8, describes two pieces JPEG doesn’t have. The first is intra prediction: each block is reconstructed from the already-decoded pixels of its neighboring blocks, above and to the left, instead of being compressed in isolation. The second is a loop filter that smooths the edges between blocks after quantization, meant to disguise the blocking artifacts typical of aggressive compression. Both improve visual quality, but as a side effect they propagate any content change beyond the block where it originally occurred.

Karpiniec didn’t test what happens at different quality levels. It’s reasonable to think that higher quality reduces quantization, and with it some of the leak, but the loop filter stays active unless explicitly disabled, so there’s no guarantee that raising the quality is enough to close the problem.

RFC 6386 defines the intra prediction and loop filter that VP8, the codec behind WebP, uses. Foto de Trnava University en Unsplash

What This Means If You Redact Screenshots at Work

If you work on a support, legal or compliance team that redacts screenshots before uploading them to a ticket, a repository or an external channel (a national ID, a credit card number, an API token exposed in an error message), the right question isn’t “did I cover the data well?” but “what format did the image pass through before and after covering the data?” If your screenshot pipeline automatically converts to lossy WebP (common, since browsers and screenshot tools default to it to save space), check at which step that conversion happens.

The concrete rule: always redact on a lossless source (PNG, or the original WebP without recompressing) and only afterward, if needed, compress the final result to WebP or JPEG. If your redaction tool receives a file that’s already been converted to lossy WebP, the damage may already be done before the black box ever touches the screen.

If You’ve Already Shared a Redacted WebP Screenshot

Treat the file as potentially compromised, not as resolved. If the redacted WebP image contained a credential, an API key or a token, rotate it: there’s no quick way to confirm whether someone has already extracted that information from the compression artifacts. Regenerate the redaction from the lossless source (if it still exists) and, if you distributed the original file over chat or email, ask the recipients to delete their cached copy instead of trusting that the republished file will replace it.

Which Format to Use for Redaction: JPEG, WebP and PNG

FormatIndependent blocksKnown safe marginRecommendation
Lossy JPEGYes, 8×8 DCT8 pixels around the contentSafe if the margin is respected
Lossy WebP (VP8)No: intra prediction and the loop filter span blocksNone confirmedAvoid as a redaction source
PNG or lossless WebPNot applicable (no quantization)No margin neededRedact here, then compress afterward

To convert an image to PNG or lossless WebP before redacting it, the official ImageMagick and FFmpeg pages document the parameters needed; neither requires anything beyond what their own usage documentation describes.

What the Experiment Still Doesn’t Answer

Karpiniec is clear about the limits of his own finding: “image forensics isn’t my specialty,” and he doesn’t claim it’s trivial to reconstruct redacted content from the leak (source). His test uses a single word, a fixed quality setting and a box with 2 pixels of margin; it doesn’t measure how exploitable the leak is with longer text, different quality levels or boxes wider than JPEG’s.

The discussion it sparked on Hacker News hasn’t produced a standard mitigation for WebP equivalent to JPEG’s 8-pixel rule either, so far. That’s why the only solid recommendation remains avoiding the lossy format as a redaction source, rather than trusting a margin that still hasn’t been measured.

It also hasn’t been tested whether AVIF, which inherits intra prediction from AV1 in a way similar to how VP8 gives it to WebP, behaves any differently in this scenario. Until someone repeats the experiment with that format, it’s worth treating it with the same caution.

📬 Get new articles by email

We only email about big articles (1-2 a month).

Frequently Asked Questions

Is PNG always safe for redaction?

Yes, because PNG doesn’t apply lossy compression: there’s no quantization that could spread information outside the covered area. The risk only appears if, at some point before or after the redaction, the image passed through a lossy format like JPEG or WebP.

How do I know if a screenshot already went through lossy WebP?

Check the file extension and the step in your pipeline that generates the screenshot: many browsers and optimization tools convert images to WebP automatically to save bandwidth, before they reach the person doing the redaction.

Does this also apply to video frames?

Karpiniec’s experiment covers only static JPEG and WebP. Video codecs with block-based compression and prediction, like H.264 or AV1, are reasonable candidates for the same problem, but no published test confirms it yet.

References

  • Take care redacting WebP images: the original experiment with JPEG and WebP comparing the redaction leak.
  • Hacker News discussion: the thread where the community reacted to the finding.
  • RFC 6386: the VP8 specification defining intra prediction and the loop filter.
  • ITU-T T.81: the JPEG specification defining 8×8 DCT blocks.

Featured image: Foto de Aniket Narula en Unsplash

How each article is made (sources, testing and editorial criteria): How we work.

Did it work for you? Got a different error? Say so below: questions get answered and help the next reader.

Leave a comment
Categories: Tech NewsTutorials

El Solitario Editorial

Article prepared by the El Solitario editorial team from cited sources, under the editorial responsibility of Luis Navarro. More details in "How we work".

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

You can include code inside <code>…</code> or, for several lines, <pre><code>…</code></pre>.

This site uses Akismet to reduce spam. Learn how your comment data is processed.