Native Windows 11 Thumbnail Extraction for Java (Explorer-Parity, High-DPI, Zero-Copy)
FastThumb is an ultra-fast, native thumbnail extractor for Windows 10/11.
It leverages IShellItem + IShellItemImageFactory — the exact same APIs used by Windows Explorer.
It provides High-DPI thumbnails (up to 512px+), folder previews, video keyframes, and composite thumbnails, perfectly integrated into the FastJava ecosystem.
- Explorer-Parity — Identical thumbnails to Windows Explorer (colors, cropping, DPI, video frames, folder preview logic).
- High-DPI Support — 32px → 512px → unbounded. No 48px limitation like Java
ShellFolder. - Zero-Copy JNI Pipeline — Native DIB → DirectByteBuffer → FastImage.
- Folder Preview Logic (Win11) — Micro-thumbnails, composite layouts, and content-sampling.
- Video & Multimedia — Keyframes, album art, PDF/Office previews (via Explorer backend).
- STA-Thread Engine — COM Thumbnail APIs run in a dedicated STA thread for maximum stability.
- FastJava Integration — Seamlessly combines with FastIO, FastFileIndex, FastImage, and FastWindow.
public final class FastThumb {
/**
* Extracts a thumbnail for a single file or folder.
* Returns a FastImage (ARGB, zero-copy).
*/
public static FastImage get(Path path, int size);
/**
* Extracts a folder preview (composite thumbnail showing contents).
*/
public static FastImage getFolder(Path folder, int size);
/**
* Check if FastThumb is supported on the current system.
*/
public static boolean isSupported();
}FastImage(ARGB, direct, zero-copy).- Guaranteed High-DPI and Explorer-consistent.
- Item without thumbnail →
null(falls back to icon if available). - Folder empty →
null. - Not supported →
isSupported() == false.
Path p = Paths.get("C:/Users/Andre/Pictures/IMG_00123.JPG");
FastImage img = FastThumb.get(p, 256);
if (img != null) {
viewer.draw(img); // FastWindow / FastUI
}Folder Preview:
FastImage preview = FastThumb.getFolder(Paths.get("C:/Users/Andre/Pictures"), 256);Java
└── FastThumb.get(path, size)
↓ JNI (Zero-Copy)
Native (C++)
├── CoInitializeEx(STA) (Dedicated Thread)
├── SHCreateItemFromParsingName
├── IShellItemImageFactory::GetImage(size)
├── HBITMAP → DIB → DirectByteBuffer
└── return to Java (FastImage)
- Always STA-Thread: All COM operations are proxied to a dedicated Single-Threaded Apartment thread to prevent deadlocks and undefined behavior.
- Always High-DPI: Leverages
IShellItemImageFactoryfor high-resolution assets (256px, 512px, 1024px) without scaling artifacts. - Always Explorer-Parity: Matches the exact Windows look and feel, including video frame overlays and folder contents.
- Zero-Copy: Pixels are written directly into a native buffer that
FastImagemanages. No intermediateint[]copies.
| Operation | FastThumb | Java ShellFolder | Speedup |
|---|---|---|---|
| 128px Thumbnail | 0.3 – 1.2 ms | 20 – 40 ms | ~30x |
| 256px Thumbnail | 0.5 – 2.0 ms | Not supported | ∞ |
| 512px Thumbnail | 3.0 – 5.0 ms | Not supported | ∞ |
| Folder Preview | 1.0 – 4.0 ms | Not supported | ∞ |
Note: Benchmarks performed on Windows 11, NVMe SSD.
FastThumb replicates the exact Explorer heuristic:
- Sampling: Samples the first N files for content previews.
- Prioritization: Images > Videos > Documents.
- Grid Layout: Automatic 2x2 or 3x3 composite grid for folders.
- DPI Awareness: Renders micro-thumbnails at the appropriate scale.
- IThumbnailCache Integration — Persistent cache hits for sub-millisecond retrieval.
- Async Batch Extraction — Non-blocking extraction for large directories.
- Video Keyframe Override — Custom decoders for specific video offsets.
- DirectStorage Prefetch — FastIO integration for lightning-fast loading.
- FastUI ThumbnailGrid — GPU-accelerated component for browsing thousands of items.
- Windows 10/11 (x64)
- Java 17+
- FastImage (Required for zero-copy returns)
Made with ⚡ by Andre Stubbe