Skip to content

Instantly share code, notes, and snippets.

@gzagatti
Last active August 9, 2025 14:24
Show Gist options
  • Save gzagatti/bf9f3c0d69678d48f0bc67ca32ae10bb to your computer and use it in GitHub Desktop.
Save gzagatti/bf9f3c0d69678d48f0bc67ca32ae10bb to your computer and use it in GitHub Desktop.
Deleting GPS tags from images using exiv2
# get the GPS keys from a random image
# we assume that all images have the same metadata fields,
# since they were obtained from the same device in similar conditions
export opts=$(exiv2 -p a IMG_2421.JPG | grep -i 'gps' | awk -F " " -v q='"' '{print "-M" q "del " $1 q}' | tr '\n' ' ')
# delete the keys from the metadata
for f in `ls`; do eval "exiv2 $opts $f"; done
@celesteking
Copy link

celesteking commented Aug 9, 2025

opts=$(exiv2 -Pk --grep gps/i BLAH.jpg | xargs -i echo -n  -M"del {}")
find . -xdev -type f -exec exiv2 "$opts" "{}" \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment