geotag
基于 exiftool 和 GPX 文件的批量图片地理标记 CLI 工具。
特性
- 支持多线程批量处理图片
- 支持多个目录同时处理
- 支持灵活的日期表达式过滤(如
date > 20250101 and date < 20260101),也可以不过滤 - 支持 dry-run 预览
- 自动分发任务到多线程
安装
- 安装 Python 3.12+
- 安装 exiftool(需加入系统 PATH)
- 安装本工具:
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-DD、YYYY/MM/DD- ISO 8601(如 2025-05-25T10:00:00+08:00)
- Unix 时间戳(秒)
依赖
- Python 3.12+
- exiftool
发布到 PyPI
- 安装构建工具:
pip install build twine
- 构建包:
python -m build
- 上传:
twine upload dist/*
License
MIT
Metadata
Release files for geotag 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geotag-0.2.0.tar.gz | 14.4 kB | Without provenance | Details for geotag-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geotag-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for geotag-0.2.0-py3-none-any.whl |
Total release size: 27.9 kB
Release files / geotag-0.2.0.tar.gz
| Download URL | geotag-0.2.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fb18cfb760abe621f0c8746171e4de27b735b1ecfc48387894b6fbbb1aa9a12
|
|
BLAKE2b-256 checksum How to use checksums |
af44ac63ef7f807b51c7c4e6b7b65be6188ea94a5d255533e575cdc06027eb54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / geotag-0.2.0-py3-none-any.whl
| Download URL | geotag-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2896e89606ae6a747c02a276f94a0e1db754621211c3ce07eb5a654be1a1265
|
|
BLAKE2b-256 checksum How to use checksums |
21b4bd81c2f6b4f196bc74aeebe1b54e11cbc32ca2bd1056d9b19c5e8883c85c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Security for geotag 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.