Skip to content

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FastGrab 0.1.0 [ALPHA] β€” Ultra-Fast Uncompressed Screen Capture CLI & Global Hotkey Daemon for Java

Status License: MIT Java Platform JitPack


⚑ Bit-perfect uncompressed screen grabs in under 1 millisecond. Direct DirectX 11 DXGI GPU capture, zero GC pressure, and native system-wide hotkeys.

FastGrab is a minimalist, ultra-responsive replacement for bloated screenshot utilities like ShareX and Windows Snipping Tool. Instead of freezing the desktop and forcing heavy PNG compression, FastGrab streams raw uncompressed BMP / BGRA byte buffers straight from the GPU frame buffer to NVMe storage.


Quick Start

1. Instant Desktop Grab via CLI Launcher

FastGrab.bat

Captures the entire desktop at hardware resolution and writes a bit-perfect uncompressed .bmp into grabs/.

2. Background Daemon with Global Hotkey

FastGrab.bat --daemon --hotkey F10

Runs quietly in the background. Pressing [F10] anywhere in Windows triggers an instant snapshot without UI lag or focus interruption.

3. Programmatic Java API

import fastscreen.FastScreen;
import fastgrab.FastBmpWriter;

public class Demo {
    public static void main(String[] args) throws Exception {
        FastScreen screen = new FastScreen();
        try {
            int[] pixels = screen.captureRaw(0, 0, 1920, 1080);
            FastBmpWriter.writeBmp("instant_grab.bmp", 1920, 1080, pixels);
        } finally {
            screen.dispose();
        }
    }
}

Table of Contents


Why FastGrab?

Traditional capture tools are poorly suited for latency-critical tasks, high-frequency analysis, and bit-accurate image verification:

  1. Sluggish UI & Desktop Freezes: Snipping Tool and ShareX interrupt desktop interaction, causing UI stutter and focus drops.
  2. Forced CPU Compression Overhead: Enforcing PNG/JPEG encoding burns 20–100 ms of CPU time per frame and creates compression artifacts.
  3. Severe GC Stalls: Legacy Java capture tools allocate tens of megabytes per frame on the JVM heap.

FastGrab bypasses these limitations:

  • Direct DXGI Desktop Duplication: Raw GPU framebuffer extraction in <1 ms via FastScreen.
  • Bit-Perfect 100% Raw BMP: Lossless uncompressed files instantly openable in any viewer or editor.
  • Global Low-Latency Hooks: Instantaneous event response via FastHotkey.
  • Zero JVM GC Allocations: Zero-copy off-heap memory path straight to disk.

Key Features

  • ⚑ Instant Capture Throughput β€” Captures and commits full desktop frames in milliseconds.
  • 🎯 Bit-Perfect Quality β€” 100% uncompressed raw BGRA/ARGB data without lossy artifacts.
  • ⌨️ Global Native Hotkeys β€” Background daemon mode listening for F1–F12 or PrintScreen.
  • πŸ“ Direct-to-Disk DMA β€” Streamlined Little-Endian BMP serialization bypassing OS memory bloat.
  • πŸ”— FastJava Synergy β€” Powered by FastScreen, FastHotkey, and FastCore.

Real-World Use Cases

  • ⚑ Zero-Lag Screenshot Hotkey Daemon: Replace bloated screenshot utilities (ShareX, Windows Snipping Tool) with a background process that commits full-resolution desktop captures in <6 ms without UI pauses or window flashes.
  • 🎯 Bit-Exact Visual Regression & UI Testing: Capture pristine, 100% uncompressed frames during automated UI / rendering test suites (e.g., Selenium, JavaFX, OpenGL, Vulkan) where PNG compression artifacts or color subsampling would cause false positive diffs.
  • 🏎️ High-Speed Gameplay & Event Bursting: Burst-capture 5–60 consecutive uncompressed frames (--burst 10) at full monitor refresh rates during rapid in-game action, physics anomalies, or micro-stutters.
  • πŸ€– Dataset Generation for Vision & OCR Pipelines: Rapidly collect hundreds of raw screen patches per second without GPU/CPU encoding bottlenecks for training OCR, layout parsing, or object detection models.
  • πŸ“Š Financial & High-Frequency Trading Telemetry: Archive pixel-accurate order book states, charts, and millisecond ticker snapshots without introducing thread latency to execution algorithms.

Architecture & Pipeline

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 Windows OS Global Hotkey                    β”‚
β”‚                        (FastHotkey)                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚ Instant Key Event (<0.1ms)
                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   FastGrab Daemon Engine                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚ Request Frame (<1ms)
                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         FastScreen                          β”‚
β”‚          (DirectX 11 DXGI GPU Desktop Duplication)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚ Zero-Copy Off-Heap BGRA Buffer
                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       FastBmpWriter                         β”‚
β”‚               (54-Byte Top-Down DIB Header)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚ Direct NIO Channel Write
                               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 Fast Storage / NVMe SSD (.bmp)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Performance Benchmarks

Measured on official JMH benchmark suite (run-benchmark.bat):

Benchmark                              Mode  Cnt   Score   Error   Units
Benchmark.benchmarkFastGrabBmpWriter  thrpt    3   0.221          ops/ms

Note

Environment & Setup: Measured on an 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (4C/8T), Windows 11 Home, OpenJDK 21 LTS. Writing uncompressed 800Γ—600 full 32-bit frames directly to disk achieves >220 full frames / sec with zero JVM heap garbage allocations.


API Quick Reference

FastGrab provides both high-speed Java methods and a standalone CLI tool:

Java API (FastBmpWriter)

Class Method Return Type Description
FastBmpWriter writeBmp(String path, int w, int h, int[] pixels) void Writes 32-bit ARGB/BGRA pixel array directly to uncompressed Windows BMP file (top-down DIB).
FastBmpWriter writeDirectBgra(String path, int w, int h, ByteBuffer buffer) void Zero-Copy: Streams direct off-heap native buffer straight to disk via NIO FileChannel.

CLI Options Reference

Switch Long Option Argument Description Default
-d --daemon - Runs continuously in background listening for global hotkey false
-k --hotkey <KEY> Hotkey keycode name (F1–F12, PRINTSCREEN) F10
-o --out <path.bmp> Custom output file path for single capture grab_YYYYMMDD_HHMMSS_SSS.bmp
-r --rect <x,y,w,h> Explicit capture region coordinates Full primary screen
-b --burst <count> Consecutive frame burst count 1
-h --help - Prints usage instructions and switches -

Installation

Option 1: Maven (pom.xml)

Add the JitPack repository and the dependencies to your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <!-- FastGrab Engine -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastGrab</artifactId>
        <version>0.1.0</version>
    </dependency>

    <!-- Underlying Hardware Engines -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastScreen</artifactId>
        <version>0.1.2</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fasthotkey</artifactId>
        <version>0.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastCore</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>

Option 2: Gradle (build.gradle)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:FastGrab:0.1.0'
    implementation 'com.github.andrestubbe:FastScreen:0.1.2'
    implementation 'com.github.andrestubbe:fasthotkey:0.1.0'
    implementation 'com.github.andrestubbe:FastCore:0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest pre-compiled JARs directly to add them to your project's classpath or use the CLI directly:

  1. πŸ“Έ FastGrab-0.1.0.jar (The CLI & Capture Engine)
  2. πŸ–₯️ FastScreen-0.1.2.jar (DirectX 11 DXGI Desktop Capture)
  3. ⌨️ FastHotkey-0.1.0.jar (Low-Latency Win32 Hotkeys)
  4. βš™οΈ FastCore-0.1.0.jar (Mandatory Native Library Loader)

Important

FastGrab requires FastScreen (and its native DLL), FastHotkey, and FastCore on the classpath to run.


Documentation

  • PHILOSOPHY.md: The engineering rationale for uncompressed zero-latency captures.
  • REFERENCE.md: Complete CLI switches and Java API reference.
  • CHANGELOG.md: Full release history and version notes.
  • ROADMAP.md: Upcoming features, 60+ FPS video streaming, and ecosystem milestones.

Platform Support

Platform Status
Windows 10/11 (x64) βœ… Fully Supported (DirectX 11 DXGI + Win32 Hooks)
Linux 🚧 Planned
macOS 🚧 Planned

License

MIT License β€” See LICENSE for details.


Related Projects

  • FastScreen β€” Ultra-Fast DirectX Screen Capture Engine
  • FastCamera β€” Hardware-Accelerated Native Camera Capture & Streaming
  • FastHotkey β€” Low-Latency Global System Hotkeys
  • FastImage β€” SIMD-Accelerated Off-Heap Image Engine
  • FastCore β€” Native Library Loader for Java

Part of the FastJava Ecosystem β€” Making the JVM faster. ⚑

About

πŸ“Έ Ultra-fast uncompressed screen capture CLI and global hotkey daemon for Java

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages