Skip to main content

How ByteScrub works

See how ByteScrub cleans JPEG, PNG and WebP files in your browser, which metadata it removes, and how it preserves the encoded image data.

From original file to clean copy

When you choose a photo, a Web Worker in your browser reads its bytes. The first bytes identify the file as JPEG, PNG or WebP. The worker walks the file in order and reports the records it recognizes, including embedded Content Credentials, GPS fields and generation prompts. Your original file stays on your device.

Selecting Clean builds a new file. The worker copies the encoded image data and the blocks needed to display it, then rebuilds structural fields such as lengths and offsets where necessary. There is no decode-and-recompress step. The worker inspects the output again before offering it for download. Verified clean reports the result of that file inspection.

Local browser pipeline: read bytes, inspect metadata, rebuild image without recompression, re-check and download with zero bytes uploaded. BROWSER WEB WORKER · LOCAL ONLY 0 BYTES UPLOADED 01 · INPUT Read bytes Original JPEG, PNG or WebP stays on device 02 · INSPECT Find records C2PA, XMP, EXIF GPS, serial, PNG prompts 03 · REBUILD Allowlist copy Copy pixel data byte for byte, keep ICC & angle 04 · VERIFY Verified clean Second pass confirms clean before download
All four steps run inside a local Web Worker in your browser. Your original photo never leaves your device.

What happens to JPEG segments?

A JPEG contains one or more compressed scans and a series of short records called segments. A portrait photo, for example, may rely on an EXIF orientation value to tell a viewer which way is up. The default cleaner reads that value before discarding the original EXIF record.

JPEG segments copied, rebuilt or removed around the compressed scans. Copy Scans + coding tables JFIF · ICC · Adobe APP14 Rebuild Orientation EXIF MPF sizes and offsets when needed Remove Other EXIF · XMP · IPTC JUMBF / C2PA · comments · thumbnails
JPEG keeps the compressed scans, rebuilds orientation and multi-image pointers as needed, and drops the original metadata segments.
ActionJPEG segments
CopyThe compressed scans and coding markers, including quantization and Huffman tables, frame headers, scan headers and restart markers.
CopyThe JFIF record in APP0, all ICC color profile segments in APP2 in their original order, and the Adobe color transform in APP14.
Rebuild when neededA minimal APP1 EXIF record for orientation. For a JPEG with indexed secondary images, the engine processes the images separately and updates the MPF sizes and offsets in APP2.
RemoveJFXX thumbnails, the original EXIF, ordinary and extended XMP, APP11 JUMBF containers including C2PA, APP13 Photoshop/IPTC records, JPEG comments and unrecognized application segments.

The multi-image path retains ISO 21496 gain-map records and rebuilds the primary image directory when needed. A secondary JPEG's gain-map XMP packet is copied whole, including any other fields stored in that packet. Extra bytes outside the indexed images are discarded. If a motion photo carries a video at the end, keep the original to retain that video.

What happens to PNG chunks?

A PNG stores its image data in one or more IDAT chunks. A text chunk can sit immediately beside them and contain an entire editing workflow. Each chunk has its own length and checksum, so removing the workflow leaves the compressed pixels intact.

PNG chunk handling for IDAT pixels, animation, orientation and embedded text. Copy IHDR · IDAT · IEND Palette, color, transparency and APNG Rebuild Orientation eXIf Before IDAT, with a new checksum Remove Text chunks · caBX · tIME Original eXIf and other unlisted chunks
PNG keeps image and display chunks, rewrites orientation when needed, and removes text and credential chunks.
ActionPNG chunks
CopyCritical chunks, including IHDR, PLTE, IDAT and IEND.
CopyTransparency, color and display information in tRNS, cHRM, gAMA, iCCP, sBIT, sRGB, cICP, mDCv, cLLI, bKGD and pHYs.
CopyAPNG animation control and frame chunks: acTL, fcTL and fdAT.
RemoveText in tEXt, zTXt and iTXt, the original eXIf, timestamps in tIME, C2PA in caBX and other ancillary chunks outside the list above.

When orientation is needed, the engine writes a small replacement eXIf chunk before the first IDAT and computes its checksum. For compressed text, the inspection report can show the key and byte count without expanding the text.

What happens to WebP chunks?

WebP uses a RIFF container. The cleaner keeps the image or animation payload and updates the container to describe the chunks in the new file.

WebP chunk handling for image data, RIFF length, VP8X flags and removable metadata. Copy VP8 / VP8L · ALPH · ICCP ANIM and ANMF animation payloads Rebuild RIFF length + VP8X flags Orientation-only EXIF when needed Remove Original EXIF · XMP · C2PA Other unrecognized chunks
WebP keeps the image or animation payload and updates the container headers to match the remaining chunks.
ActionWebP chunks
CopyLossy VP8 or lossless VP8L image data, ALPH transparency, ANIM and ANMF animation data, and the ICCP color profile.
UpdateThe metadata flags in the VP8X header and the RIFF length. Chunks retain the required even-byte alignment.
RemoveThe original EXIF, XMP, C2PA and unrecognized chunks. A replacement orientation-only EXIF chunk is written when needed.

What we can't remove

SynthID is an invisible watermark embedded in the image signal. Visible watermarks, logos and text drawn onto a picture also travel with its pixels. All of them survive this process. A visual classifier can still examine the cleaned image, and a platform can still use your disclosure or information about an earlier upload when labeling a post.

Two layers inside an image file: metadata removed by ByteScrub versus pixel-level watermarks and visual classifiers untouched by metadata cleaning. CONTAINER & METADATA LAYER · REMOVED Structured records stored alongside the compressed image stream. C2PA / JUMBF XMP & SourceType EXIF GPS & Serial PNG Prompts PIXEL & SIGNAL LAYER · UNTOUCHED ByteScrub copies compressed pixels verbatim — anything embedded in pixels stays. Image Pixels SynthID Watermark Visible Watermarks Visual Classifiers
ByteScrub removes structured metadata containers while leaving the compressed pixel layer and any pixel-embedded watermarks untouched.

The checker identifies embedded C2PA records. Cryptographic signature validation and conclusions about who created the picture are outside this inspection.

Source code

The format readers, cleaner and round-trip tests live in the @bytescrub/core package. The public repository link will appear here when the source is released.

Back to home