Field notes · Oct 2026
Taking GPS off a photo without touching a pixel
Lossless metadata removal for JPEG, PNG and WebP, and why the rotation tag goes back in.
A phone photo can carry where it was taken, to a few metres, plus the camera, the time and sometimes the owner's name. On a site like ours that's a safety problem, so it comes off before anyone sees the photo.
Re-encoding would drop it, but it costs quality and time. We copy the image data byte for byte and drop only the metadata:
- JPEG: the EXIF, XMP and IPTC blocks, and comments
- PNG: the eXIf chunk and the text chunks
- WebP: the EXIF and XMP chunks, and their flags in the header
The catch
A JPEG keeps its rotation in the same block as its GPS. Drop the block and every portrait turns on its side. So we put back a tiny EXIF block that holds only the orientation.
We're opening the code as photo-metadata.