Skip to main content

Multithread geotagging of photos using EXIF and GPX data

Project description

geotag

基于 exiftool 和 GPX 文件的批量图片地理标记 CLI 工具。

特性

  • 支持多线程批量处理图片
  • 支持多个目录同时处理
  • 支持灵活的日期表达式过滤(如 date > 20250101 and date < 20260101),也可以不过滤
  • 支持 dry-run 预览
  • 自动分发任务到多线程

安装

  1. 安装 Python 3.12+
  2. 安装 exiftool(需加入系统 PATH)
  3. 安装本工具:
pip install .

或直接通过 PyPI(发布后):

pip install geotag

使用 pipx 安装

推荐使用 pipx 进行全局隔离安装:

pipx install geotag

安装后可直接在命令行使用 geotag 命令。

用法

geotag --dirs <目录1> [目录2 ...] --gpx <gpx文件1> [gpx文件2 ...] [--filter <日期表达式>] [--threads N] [--dry-run]

示例

# 处理单个目录,不过滤日期
geotag --dirs ./photos --gpx track1.gpx

# 处理多个目录,应用日期过滤
geotag --dirs ./photos1 ./photos2 --gpx track1.gpx track2.gpx --filter "date > 20250101"

# 复杂日期过滤和自定义线程数
geotag --dirs ./photos --gpx track1.gpx track2.gpx --filter "date > 20250101 and date < 20260101" --threads 8

# 预览模式(不实际修改文件)
geotag --dirs ./photos --gpx track1.gpx --filter "date > 20250101" --dry-run

参数说明

  • --dirs:待处理图片的文件夹(可以指定多个)
  • --gpx:GPX轨迹文件(可以指定多个)
  • --filter:可选的日期过滤表达式,如果不指定则处理所有文件
  • --threads:线程数(可选,默认自动)
  • --dry-run:仅显示将要执行的命令,不实际修改文件

日期表达式语法

  • 支持 date >, <, =, >=, <=, != 等比较
  • 支持 and, or 逻辑组合,支持括号
  • 日期格式支持:
    • YYYYMMDD(如 20250101)
    • YYYY-MM-DDYYYY/MM/DD
    • ISO 8601(如 2025-05-25T10:00:00+08:00)
    • Unix 时间戳(秒)

依赖

  • Python 3.12+
  • exiftool

发布到 PyPI

  1. 安装构建工具:
    pip install build twine
    
  2. 构建包:
    python -m build
    
  3. 上传:
    twine upload dist/*
    

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geotag-0.2.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geotag-0.2.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file geotag-0.2.0.tar.gz.

File metadata

  • Download URL: geotag-0.2.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for geotag-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9fb18cfb760abe621f0c8746171e4de27b735b1ecfc48387894b6fbbb1aa9a12
MD5 2500b8c107cc66261c7946de9a4024f7
BLAKE2b-256 af44ac63ef7f807b51c7c4e6b7b65be6188ea94a5d255533e575cdc06027eb54

See more details on using hashes here.

File details

Details for the file geotag-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: geotag-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for geotag-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2896e89606ae6a747c02a276f94a0e1db754621211c3ce07eb5a654be1a1265
MD5 32a2e30edf97c11502b44807081298fe
BLAKE2b-256 21b4bd81c2f6b4f196bc74aeebe1b54e11cbc32ca2bd1056d9b19c5e8883c85c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page