image - Python 从图像中去除所有 GPS 元数据

有没有一种简单的方法,在 windows 和 linux(Ubuntu Linux 和 Windows 7,都是 64 位的 Python 2.7)上,去除目录中所有图像上的所有(不仅仅是 EXIF)GPS 元数据,并保留其余部分元数据完好无损?它只需要适用于 JPG 和 PNG。

最佳答案

这不是我想要的,但我使用 PyExiv2 编写了一个脚本这会掩盖一些 GPS EXIF 数据。这是脚本。

#!/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()

编辑:这显然(至少在 Windows 上)不会去除纬度和经度。

https://stackoverflow.com/questions/11149328/

相关文章:

python - 在 python 中使用 native 文件管理器复制文件

ruby-on-rails - 尝试使用 Google Calendar API 时出现 "Miss

reporting-services - 忽略 SSRS 设备信息配置更改

ruby-on-rails - 将 Rails 应用程序连接到 Microsoft Access

c# - 当本地服务帐户在服务中运行时,并非有关 Process.GetProcesses 中进程的

python - 使用 python 需求文件,您可以控制安装包依赖项的顺序吗?

regex - 基于预定义文本字符串的复杂正则表达式来阻止色情

php - 服务层和模型与领域驱动设计的关联

python - 如何在 python smtplib 模块中设置主机地址?

.net - IBM.Data.DB2.DB2Exception : ERROR [08001] [