Screen Capture Quick Reference
Switch Capture Providerโ
Method 1: Properties File โ (Recommended)โ
# application.properties
# Default is already SIKULIX, but you can change it:
brobot.capture.provider=SIKULIX # Default (or ROBOT, FFMPEG, AUTO)
# DPI auto-detection is enabled by default:
brobot.dpi.resize-factor=auto
Method 2: Command Lineโ
java -Dbrobot.capture.provider=FFMPEG -jar myapp.jar
Method 3: Runtime Codeโ
@Autowired
private CaptureConfiguration config;
config.useRobot(); // Switch to Robot
config.useFFmpeg(); // Switch to FFmpeg (JavaCV)
config.useSikuliX(); // Switch to SikuliX
Provider Comparisonโ
Provider | Dependencies | Resolution | Performance | Setup | Default |
---|---|---|---|---|---|
SikuliX | SikuliX (included) | Auto-handled | Good | None | โ Yes |
Robot | None | Physical* | Fast | None | No |
FFmpeg | JavaCV (included) | Physical | Good | None | No |
*Robot scales logical to physical when DPI scaling detected
SikuliX uses auto resize-factor for DPI handling
Essential Propertiesโ
# Choose provider (SIKULIX is default, or ROBOT, FFMPEG, AUTO)
brobot.capture.provider=SIKULIX
# DPI auto-detection (enabled by default)
brobot.dpi.resize-factor=auto
# Robot: Enable physical resolution scaling
brobot.capture.robot.scale-to-physical=true
brobot.capture.robot.expected-physical-width=1920
brobot.capture.robot.expected-physical-height=1080
# FFmpeg: Configure capture (uses JavaCV)
brobot.capture.ffmpeg.timeout=5
brobot.capture.ffmpeg.format=png
# General: Enable retry and fallback
brobot.capture.auto-retry=true
brobot.capture.retry-count=3
brobot.capture.fallback-enabled=true
Usage Examplesโ
Basic Captureโ
@Autowired
private UnifiedCaptureService capture;
// Same code works with ANY provider!
BufferedImage screen = capture.captureScreen();
BufferedImage region = capture.captureRegion(new Rectangle(100, 100, 400, 300));
Check Configurationโ
@Autowired
private CaptureConfiguration config;
// Current provider
String provider = config.getCurrentProvider();
// Physical resolution?
boolean physical = config.isCapturingPhysicalResolution();
// Print full report
config.printConfigurationReport();
Common Scenariosโ
Scenario 1: Development Machineโ
# Use default SikuliX with auto DPI
# (No configuration needed - these are defaults)
brobot.capture.provider=SIKULIX
brobot.dpi.resize-factor=auto
Scenario 2: CI/CD Pipelineโ
# Auto-select best available
brobot.capture.provider=AUTO
brobot.capture.fallback-enabled=true
Scenario 3: Production Serverโ
# Use FFmpeg for accuracy
brobot.capture.provider=FFMPEG
brobot.capture.retry-count=5
Scenario 4: Windows with DPI Scalingโ
# Robot with scaling compensation
brobot.capture.provider=ROBOT
brobot.capture.robot.scale-to-physical=true
brobot.capture.robot.expected-physical-width=1920
Troubleshootingโ
Issue | Solution |
---|---|
Wrong resolution (1536x864) | Enable Robot scaling: brobot.capture.robot.scale-to-physical=true |
Provider not available | Switch to ROBOT: brobot.capture.provider=ROBOT |
Intermittent failures | Enable retry: brobot.capture.auto-retry=true |
Need to debug | Enable logging: brobot.capture.enable-logging=true |
Decision Treeโ
Which provider should I use?
โโ Want maximum compatibility?
โ โโ Yes โ SikuliX (default, with auto DPI)
โ โโ No โ
โ
โโ Need true physical capture?
โ โโ Yes โ FFmpeg (JavaCV)
โ โโ No โ
โ
โโ Want manual DPI control?
โ โโ Yes โ Robot (with scaling settings)
โ โโ No โ
โ
โโ Need fastest performance?
โ โโ Yes โ Robot
โ โโ No โ
โ
โโ Unsure? โ Stay with SikuliX (default)
Key Pointsโ
โ
No code changes needed when switching providers
โ
FFmpeg uses JavaCV (already included in Brobot)
โ
Robot handles DPI scaling automatically
โ
Properties control everything
โ
Automatic fallback for robustness
Default Setupโ
No configuration needed! Brobot defaults to:
# These are already set in brobot-defaults.properties:
brobot.capture.provider=SIKULIX
brobot.dpi.resize-factor=auto
Your application automatically uses SikuliX with automatic DPI recognition.