Read dimensions, EXIF camera settings, capture time and GPS from local images with exiftool, Pillow or sips, and flag location data before you publish.
---
name: image-metadata-reader
description: Reads metadata from local image files - dimensions, format, EXIF camera fields, capture time and GPS coordinates - and returns it as JSON with privacy warnings. Uses exiftool when installed, otherwise Python Pillow, or sips on macOS. Use when asked what camera took a photo, when a picture was taken, whether an image contains location data, or to inspect image EXIF before publishing.
compatibility: Needs local file access plus one of exiftool, Python 3 with Pillow, or macOS sips. Does not download images unless the user explicitly asks and approves the URL.
metadata:
version: "1.0.0"
category: "computer-vision"
---
# Image Metadata Reader
Extracts the metadata that is actually stored in an image file. It reports what is present and says plainly when a field is missing; it never infers a camera, place or date from the picture's content.
## What to expect by format
- **JPEG, TIFF, HEIC, many camera RAW files**: usually carry EXIF (make, model, exposure, timestamps, sometimes GPS).
- **PNG, GIF, screenshots, images re-saved by chat apps or social networks**: often have no EXIF at all. "No EXIF found" is a normal result, not an error.
- Timestamps in EXIF have no time zone unless an `OffsetTime*` tag is present; report them as local camera time.
## Workflow
1. **Get the file.** Use a local path. If the user gives a URL, ask before downloading, save it to a temporary directory, and treat it as untrusted. Note that many websites strip metadata when serving images.
2. **Pick a tool** (first available):
- `exiftool -json -n photo.jpg` (most complete; `-n` gives numeric GPS in decimal degrees).
- Python Pillow - save the script below as `read_meta.py` and run `python3 read_meta.py photo.jpg`.
- macOS only: `sips -g all photo.jpg` (dimensions, make, model, some EXIF; no GPS decoding).
3. **Normalize the result** into the output format below. Keep raw values; convert GPS degrees/minutes/seconds to signed decimal degrees (S and W are negative).
4. **Flag privacy issues.** If GPS, owner name, serial number or software history is present, say so before the user publishes the image, and suggest removal (for example `exiftool -all= -o clean.jpg photo.jpg`, which writes a new file and leaves the original untouched). Only strip metadata if asked.
```python
import json, sys
from PIL import Image
from PIL.ExifTags import IFD, TAGS, GPSTAGS
def dms_to_deg(dms, ref):
d, m, s = (float(x) for x in dms)
deg = d + m / 60 + s / 3600
return -deg if ref in ("S", "W") else deg
def read(path):
with Image.open(path) as im:
out = {"file": path, "format": im.format, "width": im.width, "height": im.height, "mode": im.mode}
exif = im.getexif()
base = {TAGS.get(k, k): v for k, v in exif.items() if k not in (IFD.Exif, IFD.GPSInfo)}
sub = {TAGS.get(k, k): v for k, v in exif.get_ifd(IFD.Exif).items()}
gps = {GPSTAGS.get(k, k): v for k, v in exif.get_ifd(IFD.GPSInfo).items()}
out["exif"] = {k: str(v) for k, v in {**base, **sub}.items()} or None
if "GPSLatitude" in gps and "GPSLongitude" in gps:
out["gps"] = {"lat": round(dms_to_deg(gps["GPSLatitude"], gps.get("GPSLatitudeRef")), 6),
"lon": round(dms_to_deg(gps["GPSLongitude"], gps.get("GPSLongitudeRef")), 6)}
else:
out["gps"] = None
return out
print(json.dumps([read(p) for p in sys.argv[1:]], indent=2))
```
## Output format
```json
{
"file": "photo.jpg", "format": "JPEG", "width": 640, "height": 480,
"camera": {"make": "FixtureCam", "model": "FX-1"},
"exposure": {"fNumber": 2.8, "exposureTime": "1/250", "iso": 200},
"captured": "2026:11:05 09:30:00 (camera local time, no offset tag)",
"gps": {"lat": 51.5, "lon": -0.125},
"warnings": ["Contains GPS location - remove before publishing if this is private"],
"tool": "Pillow 11"
}
```
## Limitations
- Metadata can be edited or forged; it is evidence, not proof of origin.
- Pillow reads common EXIF but not XMP sidecars, maker notes or every RAW format; use exiftool for forensic-level detail.
- This skill does not identify people, places or objects from pixels.
Generate a GitHub Actions (or other CI) pipeline from the repo's real scripts, with least-privilege permissions, caching, concurrency and a gated deploy.
Generate a compose.yaml for your app, database and cache with health-checked startup, named volumes and secrets in .env, validated with docker compose config.
Automate notifications and alerts
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
Before posting a photo on a public blog, an author wants to know whether it reveals where it was taken.
Check ~/Pictures/launch/photo.jpg and ~/Pictures/launch/diagram.png for metadata. Does either contain location data?
JSON per file plus a short verdict. For a JPEG carrying EXIF (in the local fixture: make FixtureCam, model FX-1, FNumber 2.8, ExposureTime 0.004, ISO 200, GPS 51°30'0"N 0°7'30"W) the result lists those fields and converts GPS to lat 51.5, lon -0.125 with a privacy warning and an optional exiftool -all= command that writes a cleaned copy. For the PNG it reports format and size and says no EXIF or GPS was found. It names the tool used.
AI Agent Skills are reusable workflow packages that extend your AI coding assistant with multi-step capabilities. Install Image Metadata Reader by following these steps.
SKILL.md inside, in the location documented by your client. Do not assume every AI application reads the same directory.Requires an Agent Skills-compatible client; supported locations and activation vary by version. Read the SKILL.md setup guide. MCP connects tools and data and does not, by itself, install a skill.
Generate a GitHub Actions (or other CI) pipeline from the repo's real scripts, with least-privilege permissions, caching, concurrency and a gated deploy.
Generate a compose.yaml for your app, database and cache with health-checked startup, named volumes and secrets in .env, validated with docker compose config.
Automate notifications and alerts