Basic Usage
Return Value
Thescreenshot() method returns raw PNG bytes:
Working with Screenshots
Save to File
Display with PIL/Pillow
Use with OpenCV
Send to Vision API
Screenshot Loop
Capture screenshots at intervals:Client-Level Screenshots
You can also capture via the client directly:Performance Tips
Reduce capture frequency
Reduce capture frequency
Screenshots require a round-trip to the device. Capture only when needed rather than in a tight loop.
Process asynchronously
Process asynchronously
If doing heavy image processing, consider processing in a separate thread while capturing the next screenshot.
Use streaming for real-time
Use streaming for real-time
For real-time viewing, consider using TapKit’s WebRTC streaming instead of repeated screenshots.
Error Handling
- Phone not connected
- Mac app not running
- Request timeout