如何仅在使用 ExifTool 匹配坐标时删除 GPS 元数据?
How to delete GPS metadata only if it's match a coordinate using ExifTool?
我只想删除我照片的所有 GPS 信息,前提是它与特定 GPS 坐标匹配。
我已经阅读了手册页,但不确定是否可行。
要匹配一个精确的坐标,像这样(windows版本):
exiftool -if "$GPSLongitude eq '74 deg 2\' 40.20\" W' and $GPSLatitude eq '40 deg 41\' 21.28\" N'" -gps*= FileOrDir
或者如果您使用的是数字坐标
exiftool -if "$GPSLongitude# == -74.0445 and $GPSLatitude# == 40.6892444444444" -gps*= FileOrDir
我使用 -gps*=
清除了所有以 gps
开头的标签,因为可能会有更多的标签以及 XMP gps 标签。如果您想在保留 GPS direction/speed/timestamp/destination/etc 数据的同时清除位置数据,那么您可以改用 -GPSLatitude= -GPSLongitude= -GPSLatitudeRef= -GPSLongitudeRef=
(也可能 -GPSAltitude= -GPSAltitudeRef=
)。
对于 Windows 中的第一个命令,您必须使用反斜杠转义等式中单引号部分内的单引号和双引号。我不确定如何在 Mac/Linux.
上完成
一个主要问题是准确度。如果你有一个数字接近,但不完全等于文件中存储的本地 gps,你将不会得到匹配。那时,您可能需要查看 -c
选项,您可以在其中指定精度。
exiftool -if "$GPSLongitude == -74.0445 and $GPSLatitude == 40.689244" -c "%+.6f" -gps*= FileOrDir
最后,如果您想变得更复杂,您可以将任何 perl 表达式作为 -if
选项的参数。例如,您可以从 $GPSLatitude
中减去您的数字并获得绝对值以获得要比较的范围。 Example 来自 Exiftool 论坛:
exiftool -if 'abs($gpslatitude# - 52.3728268506806) < 1e-3 and abs($gpslongitude# - 4.89373108651944) < 1e-3'
我只想删除我照片的所有 GPS 信息,前提是它与特定 GPS 坐标匹配。
我已经阅读了手册页,但不确定是否可行。
要匹配一个精确的坐标,像这样(windows版本):
exiftool -if "$GPSLongitude eq '74 deg 2\' 40.20\" W' and $GPSLatitude eq '40 deg 41\' 21.28\" N'" -gps*= FileOrDir
或者如果您使用的是数字坐标
exiftool -if "$GPSLongitude# == -74.0445 and $GPSLatitude# == 40.6892444444444" -gps*= FileOrDir
我使用 -gps*=
清除了所有以 gps
开头的标签,因为可能会有更多的标签以及 XMP gps 标签。如果您想在保留 GPS direction/speed/timestamp/destination/etc 数据的同时清除位置数据,那么您可以改用 -GPSLatitude= -GPSLongitude= -GPSLatitudeRef= -GPSLongitudeRef=
(也可能 -GPSAltitude= -GPSAltitudeRef=
)。
对于 Windows 中的第一个命令,您必须使用反斜杠转义等式中单引号部分内的单引号和双引号。我不确定如何在 Mac/Linux.
上完成一个主要问题是准确度。如果你有一个数字接近,但不完全等于文件中存储的本地 gps,你将不会得到匹配。那时,您可能需要查看 -c
选项,您可以在其中指定精度。
exiftool -if "$GPSLongitude == -74.0445 and $GPSLatitude == 40.689244" -c "%+.6f" -gps*= FileOrDir
最后,如果您想变得更复杂,您可以将任何 perl 表达式作为 -if
选项的参数。例如,您可以从 $GPSLatitude
中减去您的数字并获得绝对值以获得要比较的范围。 Example 来自 Exiftool 论坛:
exiftool -if 'abs($gpslatitude# - 52.3728268506806) < 1e-3 and abs($gpslongitude# - 4.89373108651944) < 1e-3'