⚡ Ultra-fast Java screen capture library — 500-2000 FPS zero-copy capture
Keywords: fastjava, java screen capture, java screenshot, directx screen capture, dxgi desktop duplication, zero copy capture, high fps screen capture, java vision, computer vision java, gpu screen capture
FastScreen is a high-performance Java screen capture library and part of the FastJava ecosystem. It uses DXGI Desktop Duplication API for zero-copy, hardware-accelerated screen capture at 500-2000 FPS. Built for computer vision, gaming bots, screen recording, and real-time monitoring applications.
If you need high-FPS screen capture without the 50-100ms latency of java.awt.Robot, FastScreen delivers native-level performance with Java simplicity. Part of the FastJava ecosystem — Making the JVM faster.
Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastscreen</artifactId>
<version>v1.0.0</version>
</dependency>Gradle:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:fastscreen:v1.0.0'
}Direct Download (both required):
- fastscreen-1.0.0.jar — Main library with DLL
- fastcore-1.0.0.jar — JNI loader (required dependency)
# Run with both JARs
java -cp "fastscreen-1.0.0.jar:fastcore-1.0.0.jar:." YourAppimport fastscreen.FastScreen;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
FastScreen screen = new FastScreen();
// Single screenshot - 10-17× faster than Robot
BufferedImage screenshot = screen.captureScreen(new Rectangle(0, 0, 1920, 1080));
// Or get raw pixel array (zero-copy)
int[] pixels = screen.captureRaw(0, 0, 1920, 1080);// Start 60fps-240fps streaming capture
screen.startStream(0, 0, 1920, 1080);
while (true) {
if (screen.hasNewFrame()) {
int[] pixels = screen.getNextFrame(); // RGBA pixel array
double fps = screen.getStreamFPS();
System.out.println("Streaming at " + fps + " FPS");
}
}- 500-2000 FPS capture — Zero-copy DXGI Desktop Duplication
- 10-17× faster than
java.awt.Robot(8-16ms vs 50-100ms) - Hardware acceleration — GPU to CPU without memory copy
- Zero GC pressure — Native buffers, reusable arrays
- Multiple outputs — BufferedImage, raw pixels, or stream callback
- Powered by FastCore — Unified JNI loader for all FastJava modules
- MIT licensed — free for commercial use
Measure yourself — run the included benchmark:
cd examples/03-benchmark
mvn compile exec:javaExpected improvements (your hardware may vary):
- Single capture: 10-50× faster than
java.awt.Robot - Streaming: 60-240fps depending on GPU and resolution
- Zero GC pressure with native buffers
See examples/03-benchmark for detailed measurement.
All examples are in the examples/ folder:
# Basic screenshot demo
cd examples/00-basic-capture
mvn compile exec:java
# High-FPS streaming demo
cd examples/01-streaming
cd examples/02-vision-pipelinefastscreen/
├── src/main/java/fastscreen/ # Main API
│ └── FastScreen.java # Core capture class
├── examples/ # Runnable examples
│ ├── 00-basic-capture/ # Simple screenshot
│ ├── 01-streaming/ # High-FPS demo
│ └── 02-vision-pipeline/ # CV integration
├── native/ # C++ JNI source
│ ├── fastscreen.cpp # JNI wrapper
│ └── DXGICapture.cpp # DirectX capture
├── pom.xml # Maven configuration
├── README.md # This file
└── COMPILE.md # Build instructions
- JDK 17+
- Maven 3.9+
- Visual Studio 2019+ (for native DLL)
- Windows 10/11 SDK
git clone https://github.com/andrestubbe/fastscreen.git
cd fastscreen
# Build Java + native DLL
mvn clean compile
# Create JAR with native libraries
mvn packagecaptureScreen(Rectangle rect)— BufferedImage screenshotcaptureRaw(int x, int y, int w, int h)— Raw RGBA pixel arraygetPixelColor(int x, int y)— Single pixel (fast)
startStream(int x, int y, int w, int h)— Begin capture streamhasNewFrame()— Check for new frame availablegetNextFrame()— Get next frame (non-blocking)stopStream()— Stop and cleanupgetStreamFPS()— Current capture FPS
getMonitorCount()— Number of displayscaptureMonitor(int index)— Capture specific monitor
Java API (FastScreen.java)
↓ JNI (via FastCore)
Native Layer (C++/Win32)
└── DXGI Desktop Duplication API
└── Direct GPU framebuffer access
↓
Windows OS (Hardware)
Powered by FastCore — Unified JNI loader for the FastJava ecosystem.
| Platform | Status |
|---|---|
| Windows 11 | ✅ Full support |
| Windows 10 | ✅ Full support |
| Linux | ❌ Not planned (no DXGI) |
| macOS | ❌ Not planned (no DXGI) |
- DXGI Desktop Duplication API — hardware-accelerated capture
- Zero-copy streaming — 500-2000 FPS
- FastCore integration — Unified JNI loader
- Multiple output formats — BufferedImage, raw pixels
MIT License — free for commercial and private use. See LICENSE for details.
| Module | Purpose | Link |
|---|---|---|
| FastCore | JNI loader | GitHub |
| FastRobot | Input automation | GitHub |
| FastVision | GPU vision pipeline | GitHub |
| FastImage | Image processing | GitHub |
| FastGraphics | GPU rendering | GitHub |
MIT License — See LICENSE for details.
FastScreen — High-performance Java screen capture.
Part of the FastJava Ecosystem — github.com/andrestubbe
Making the JVM faster through native acceleration.