How EXIF is stored inside a JPEG
A JPEG file is a sequence of segments, each announced by a two-byte marker. Metadata lives in APP1 segments near the top of the file, before any pixel data. An EXIF APP1 segment starts with the ASCII signature Exif followed by two null bytes, then embeds a miniature TIFF file: a byte-order mark (II for little-endian, MM for big-endian), then one or more Image File Directories (IFDs). Each IFD is a flat table of 12-byte entries — tag number, data type, count, and a value or an offset to it. IFD0 holds camera-level tags like Make and Model, and two special pointer tags branch to sub-directories: 0x8769 points to the EXIF sub-IFD (exposure settings, original timestamp, lens), and 0x8825 points to the GPS sub-IFD. Because all of this sits in self-contained segments separate from the compressed image data, a cleaner can remove it with a byte-level splice and leave the pixels untouched.