搜索和查看 Apple Photos 照片库。当用户需要查找照片、浏览相册、获取照片信息时使用。Use when the user needs to search photos, browse albums, or get photo information. Keywords: 照片, Photos, 相册, 图片搜索, 相片.
通过直接查询 Apple Photos 的 SQLite 数据库来搜索和浏览照片,支持关键词搜索、按时间浏览、相册管理和照片导出。
BASE="${CLAUDE_PLUGIN_ROOT:-${CODEX_HOME:-$HOME/.codex}}"
SKILLS_ROOT="$BASE/skills"
[ -d "$SKILLS_ROOT/photos/scripts" ] || SKILLS_ROOT="$BASE/indie-toolkit/mactools/skills"
python3 ${SKILLS_ROOT}/photos/scripts/photos.py
python3 ${SKILLS_ROOT}/photos/scripts/photos.py search "关键词"
python3 ${SKILLS_ROOT}/photos/scripts/photos.py search "关键词" -n 10
按文件名、标题匹配搜索照片。
# 最近 7 天(默认)
python3 ${SKILLS_ROOT}/photos/scripts/photos.py recent
# 最近 30 天,最多 50 条
python3 ${SKILLS_ROOT}/photos/scripts/photos.py recent 30 -n 50
python3 ${SKILLS_ROOT}/photos/scripts/photos.py albums
python3 ${SKILLS_ROOT}/photos/scripts/photos.py album "相册名称"
python3 ${SKILLS_ROOT}/photos/scripts/photos.py album "相册名称" -n 50
支持精确匹配和模糊匹配。
# 按 UUID
python3 ${SKILLS_ROOT}/photos/scripts/photos.py info "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
# 按文件名
python3 ${SKILLS_ROOT}/photos/scripts/photos.py info "IMG_1234.HEIC"
显示:日期、尺寸、GPS 坐标、相机型号、镜头、焦距、文件大小等。
# 导出到指定路径
python3 ${SKILLS_ROOT}/photos/scripts/photos.py export "UUID" "/tmp/output.heic"
# 导出到目录(自动使用原文件名)
python3 ${SKILLS_ROOT}/photos/scripts/photos.py export "UUID" "/tmp/"
1. IMG_1234.HEIC
UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Date: 2026-02-10 14:30:00
Size: 4032x3024
Location: 38.4872, 106.2309
Path: ~/Pictures/Photos Library.photoslibrary/originals/A/IMG_1234.HEIC
从用户问题中判断:
根据意图选择合适的命令。如果结果太多,减小 -n;如果没找到,换关键词或扩大时间范围。
对感兴趣的照片用 info 查看详情,或用 export 导出。
找到的照片可以导出后进行文字识别,适用于:
流程:
search 或 recent 找到目标照片export 导出到临时路径(如 /tmp/photo.heic)/ocr 对导出的文件进行文字识别originals/ 或 masters/ 目录下