Take screenshots and screen recordings on macOS. Capture full screen, specific windows, or regions. Convert to gif. Use when the user wants to capture, screenshot, record, or gif their screen.
Take screenshots and screen recordings on macOS using the screencapture CLI.
| Task | Command |
|---|---|
| Full screen | screencapture /path/to/file.png |
| Specific window | screencapture -l <windowID> /path/to/file.png |
| Region | screencapture -R x,y,w,h /path/to/file.png |
| Interactive select | screencapture -i /path/to/file.png |
| Video (timed) | screencapture -v -V <seconds> /path/to/file.mov |
| Video of window | screencapture -v -V <seconds> -l <windowID> /path/to/file.mov |
| No sound | add -x |
| With cursor | add -C |
| To clipboard |
add -c (no filename) |
| Delay | -T <seconds> |
| Format | -t jpg / -t png / -t pdf |
Use the bundled helper to find window IDs:
swift "${CLAUDE_SKILL_DIR}/scripts/get-window-id.swift" "AppName"
Output: windowID ownerName windowTitle x,y,width,height
Example:
swift "${CLAUDE_SKILL_DIR}/scripts/get-window-id.swift" "Ghostty"
# 21680 Ghostty My Window Title 361,200,800,632
Use ffmpeg to convert .mov recordings to gif:
ffmpeg -i recording.mov -vf "fps=12,scale=800:-1:flags=lanczos" -loop 0 output.gif -y
Adjust parameters:
fps=12 — frame rate (lower = smaller file, choppier)scale=800:-1 — width in pixels, height auto-loop 0 — loop foreverIf you recorded full screen but only want a portion:
ffmpeg -i fullscreen.mov -vf "crop=w:h:x:y,fps=12,scale=800:-1:flags=lanczos" -loop 0 output.gif -y
Note: for Retina displays, multiply point coordinates by 2 for pixel coordinates.
Use Python with Pillow to combine screenshots:
pip3 install Pillow --user 2>/dev/null
python3 "${CLAUDE_SKILL_DIR}/scripts/before-after.py" before.png after.png output.png
When the user asks to take a screenshot or recording:
get-window-id.swift helper to find the window IDscreencapture commandbrew install ffmpeg if needed)screencapture is a macOS built-inbrew install ffmpeg)