Skip to main content
Version: Latest

Screen Capture Quick Reference

Switch Capture Providerโ€‹

# 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โ€‹

ProviderDependenciesResolutionPerformanceSetupDefault
SikuliXSikuliX (included)Auto-handledGoodNoneโœ… Yes
RobotNonePhysical*FastNoneNo
FFmpegJavaCV (included)PhysicalGoodNoneNo

*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โ€‹

IssueSolution
Wrong resolution (1536x864)Enable Robot scaling: brobot.capture.robot.scale-to-physical=true
Provider not availableSwitch to ROBOT: brobot.capture.provider=ROBOT
Intermittent failuresEnable retry: brobot.capture.auto-retry=true
Need to debugEnable 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.