screenshot command captures images of application windows.
Overview
Arguments
string
required
Application name or bundle identifier
string
Output file path (defaults to auto-generated temp file)
Options
boolean
Output as JSON with path and dimensions
Examples
Basic screenshot
Specify output path
JSON output
Capture with tilde expansion
Behavior
Window selection
The command captures the frontmost window of the specified application.If an app has multiple windows, only the active/front window is captured.
Image format
Screenshots are always saved as PNG files with the following characteristics:- Format: PNG (Portable Network Graphics)
- Resolution: Native display resolution (Retina/HiDPI aware)
- Quality: Lossless compression
- Transparency: Preserved if window has transparent areas
File path handling
- Auto-generated
- Relative path
- Absolute path
- Tilde expansion
When no path is specified:Files are created in the system temp directory with unique names:
Overwriting files
Use cases
Visual testing
Documentation generation
Bug reports
Progress monitoring
Automated tutorials
Regression testing
Advanced patterns
Screenshot on error
Timestamped series
Conditional screenshots
Integration with other tools
Image processing (ImageMagick)
Comparison tools
Upload to services
Tips
The command requires the app to have at least one window. Headless or background apps without windows will fail.