JPEG Architecture
Anatomy of a JPEG File: Markers & Metadata Payloads
A JPEG file is structured as a chronological sequence of binary markers, each prefixed by the byte 0xFF followed by a marker identifier. The standard image stream begins with the Start of Image (0xFFD8) marker and terminates with the End of Image (0xFFD9) marker.
Between these delimiters, application markers (APP0 through APP15) contain metadata streams that have no impact on the visual pixels:
- APP1 (0xFFE1) — EXIF & XMP: Contains TIFF-based tag structures defining camera settings, lens serial numbers, thumbnail previews, and the critical
GPSInfosub-IFD block containing satellite coordinates. - APP2 (0xFFE2) — ICC Color Profiles & FlashPix: Encodes color gamut specifications (such as Adobe RGB or Display P3) or extended XML packets.
- APP13 (0xFFED) — Photoshop & IPTC: Encodes legacy IPTC-NAA records, captions, copyright notices, and Adobe Image Resource Blocks (IRBs).
The actual visual photograph is stored inside the Start of Scan (0xFFDA) segment, which contains Huffman-coded Discrete Cosine Transform (DCT) coefficient blocks.
Why Canvas Re-compression Damages JPEG Photos
Standard browser-based cleaners take a JPEG, draw it onto a canvas, and re-export it. This process triggers a complete DCT dequantization and re-quantization cycle:
| Feature | Canvas Re-encoding (Standard Tools) | ManageMetadata Lossless Slicing |
|---|---|---|
| Pixel Fidelity | Generation loss; compression artifacts | 100% Bit-for-bit identical |
| Color Reproduction | Prone to sRGB/P3 color shifts | Retains original color profile |
| Processing Speed | 1–3 seconds per high-res photo | < 5 milliseconds per file |
| Batch Scalability | Crashes mobile memory on 10+ photos | Handles 30+ photos effortlessly |
By directly parsing the DataView buffer and omitting the APP1 and APP13 byte segments, ManageMetadata removes every tracking tag while preserving the original DCT pixel stream with zero generational degradation.