Is there a simple way, on windows and linux (Ubuntu Linux and Windows 7, both 64-bit with Python 2.7), to strip all (not just EXIF) GPS metadata on all images in a directory, and leave the rest of the metadata intact? It only needs to work for JPGs and PNGs.
It's not exactly what I want, but I wrote a script using PyExiv2 which obscures some GPS EXIF data. Here is the script.
#!/usr/bin/python2.7
from pyexiv2 import ImageMetadata, ExifTag
from fractions import Fraction
import argparse, os
parser = argparse.ArgumentParser(description='Strip GPS metadata.')
parser.add_argument('dir', metavar='DIRECTORY',
help='The directory to process.')
args = parser.parse_args()
files = os.listdir(args.dir)
for tiname in files:
iname = args.dir+tiname
image = ImageMetadata(iname)
image.read()
image["Exif.GPSInfo.GPSLatitude"] = Fraction(1,1)
image["Exif.GPSInfo.GPSLongitude"] = Fraction(1,1)
image.write()
EDIT: This apparently (at least on windows) does not strip the latitude and longitude.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With