read-metadata
Use when the user wants to inspect EXIF, IPTC, XMP, or GPS metadata on images without modifying anything — read out as structured JSON or a human-readable summary. Read-only counterpart to `scrub-metadata` (removes) and `set-metadata` (writes). Triggers - "what camera took this photo", "does this image have GPS in it", "show me the EXIF for this folder".
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- read-metadata
- description
- Use when the user wants to inspect EXIF, IPTC, XMP, or GPS metadata on images without modifying anything — read out as structured JSON or a human-readable summary. Read-only counterpart to `scrub-metadata` (removes) and `set-metadata` (writes). Triggers - "what camera took this photo", "does this image have GPS in it", "show me the EXIF for this folder".
- allowed-tools
- Bash(exiftool *), Bash(command *), Bash(find *), Bash(jq *), Bash(head *), Bash(wc *), Read, Write
03 SKILL.md 正文
Read Image Metadata
Extract metadata from image files using exiftool and output as structured JSON. Supports single files, batch operations, and filtering by metadata group (EXIF, IPTC, XMP, GPS, etc.).
When to use
- Inspecting the metadata on a photo before sharing or publishing.
- Auditing a batch of images to verify copyright, GPS, or camera information.
- Programmatically querying metadata for file organization or validation.
Inputs to gather
- Input file or directory — single image or folder. Default: current directory.
- Recursive? If directory, ask whether to descend. Default: no (flat).
- Filter/group (optional) — ask if they want a specific metadata subset (e.g., EXIF only, GPS only, copyright-related tags). Default: all metadata.
- Output format — JSON (default) or a human-readable summary. Recommend JSON for programmatic use, summary for quick inspection.
Procedure
1. Check tooling
command -v exiftool >/dev/null || {
echo "exiftool not installed — see the image-ops-install-deps skill" >&2
exit 1
}
2. Determine scope
- Single file: direct read.
- Directory (non-recursive): read all image files in the folder.
- Recursive: use
findto walk the tree.
3. Read metadata
Single file, full metadata as JSON:
exiftool -j "$file"
Single file, summary (human-readable):
exiftool -G1 -a -s "$file" | head -50
Filtered by group (EXIF only):
exiftool -j -a -G1 -EXIF:all "$file"
Common filters:
-EXIF:all— EXIF metadata only.-IPTC:all— IPTC tags (description, keywords, copyright).-XMP:all— XMP metadata (structured, often used by Adobe).-GPS:all— GPS coordinates (latitude, longitude, altitude).
Always write the :all suffix. A bare -EXIF or -GPS is read as a request for a single tag with that name, not the group. -EXIF returns at most the raw binary EXIF block, and -GPS matches no tag at all, so a photo with full GPS coordinates looks clean. Pair a group filter with -a, too. Without it, exiftool hides duplicate tag names, and GPS:GPSLatitude is dropped in favour of the Composite tag of the same name. The group filter then leaves only the Ref tags.
MakerNote is a single raw EXIF tag holding an undecoded binary blob, not a group you can filter on like the four above. exiftool decodes maker notes into manufacturer-named groups (Canon, Nikon, Sony, …) — filter on those, or just run unfiltered and read what appears.
Batch (directory or recursive):
exiftool already walks directories and emits one valid JSON array for the whole set. Use that rather than find -exec, which invokes exiftool once per file and concatenates N separate [...] arrays into a file that is not valid JSON:
exiftool -j -r \
-ext jpg -ext jpeg -ext png -ext heic -ext webp -ext tif -ext tiff \
"$target" > metadata.json
Drop -r for the non-recursive case. If a find-driven list is genuinely needed (e.g. a filtered subset), pipe it through jq -s 'add' to flatten the per-file arrays into one before writing.
4. Summarize or display
For JSON output:
If the user wants a summary, parse the JSON:
exiftool -j "$file" | jq '.[] | {File, Make, Model, DateTime, GPSLatitude, GPSLongitude, Copyright}'
For a batch report:
exiftool -j -a -s "$target" | jq '.[] | {FileName, Make, Model, LensModel, FocalLength, ISO, ExposureTime, FNumber}'
Pass the directory itself, not a quoted glob. "$target/*" is quoted, so the shell never expands it and exiftool receives the literal string dir/* as a filename that does not exist.
5. Report
Print the metadata (JSON or summary, per user preference). If batch:
- Count of files read.
- Any files with missing metadata.
- Common metadata patterns (e.g., "15 images from Canon EOS 5D Mark III", "8 images missing GPS").
Output / side effects
- Metadata displayed on stdout (or saved to a JSON file if requested).
- No files modified.
Notes
- Metadata standards overlap: EXIF, IPTC, and XMP sometimes describe the same field (e.g., copyright, description, keywords).
exiftool -jmerges these intelligently; check the JSON keys to see what's present. - Camera-specific tags: Each manufacturer embeds maker-specific metadata. exiftool decodes it into a manufacturer-named group — filter with
-Canon:all,-Nikon:all,-Sony:all, or run unfiltered with-G1to see which groups a given file actually carries. - GPS privacy: Check
exiftool -a -G1 -GPS:all "$file"before sharing a photo. Many smartphone cameras and some cameras embed GPS by default. - Phone metadata: iPhones embed extensive metadata in EXIF and XMP, including model, iOS version, and processing applied.
- PNG text chunks: PNG metadata lives in text chunks (
tEXt,iTXt) rather than EXIF.exiftoolreads them as XMP or PNG metadata. - Batch JSON: prefer letting exiftool walk the directory (
-j -r <dir>) — it emits one valid array. Only reach forjq -s 'add'when you had to drive it from an external file list and ended up with several concatenated arrays. - Depends on
exiftool(apt install libimage-exiftool-perlon Debian/Ubuntu,brew install exiftoolon macOS). Useimage-ops-install-depsrather than installing by hand.
04 同仓库更多 Skills
no-description
暂无简介
good-skill
Fixture skill that satisfies every rule.
broken-link
Links to a reference file that does not exist.
Bad_Name
Name violates the kebab-case rule and does not match the directory.
skill-authoring
Write, review, and validate portable agent skills in SKILL.md format. Use when creating a new skill, editing an existing one, or asked whether a skill follows the Agent Skills spec.
weigh-bags
Record scale readings for each bag — empty (tare), outbound, current, final — and reconcile them against the itemised inventory to find unaccounted weight. Use when the user gives a bag weight, says how heavy something is, weighs their luggage, or asks how close to the limit they are. Appends to bags.yaml and runs scripts/reconcile.py.