Minimal Image Viewer is an open-source, C++-based image viewing application engineered for Windows, prioritizing performance and minimalism. With a compiled size of only ~185KB. Leveraging native Windows APIs and the Windows Imaging Component (WIC), it ensures accurate functionality.
💾 Download the latest version here.
-
Comprehensive Image Format Support:
- Supports a wide array of formats via WIC, including JPEG, PNG, BMP, GIF, TIFF, ICO, WebP, HEIF, AVIF, and RAW formats (e.g., .cr2, .cr3, .nef, .dng, .arw, .orf, .rw2) with appropriate codecs installed.
- Dynamically validates files as images using WIC’s
IWICBitmapDecoder, enabling support for any WIC-compatible format without hardcoding extensions. - Preserves original file formats during save operations, ensuring fidelity for formats like TIFF and GIF.
-
Intuitive Navigation:
- Directory-based image navigation via Left/Right arrow keys or context menu ("Next Image," "Previous Image").
- Automatically indexes all WIC-supported images in the current directory, sorted lexicographically.
-
Flexible Viewing:
- Smooth zoom (0.1x–10x) via Ctrl++/-, mouse wheel, or context menu, implemented with
SetWorldTransformfor GPU-friendly scaling. - Fits images to window (Ctrl+0 or double-click), adjusting for rotation angles.
- Rotates images in 90° increments.
- Smooth zoom (0.1x–10x) via Ctrl++/-, mouse wheel, or context menu, implemented with
-
Image Management:
- Saves rotated images (Ctrl+S or context menu) in their original WIC-supported format, using temporary files to ensure atomic operations.
- Deletes images to the Recycle Bin (Delete key or context menu) for recoverable deletions.
- Opens images with a comprehensive filter for common image formats, falling back to WIC for validation.
- Copy the current view to the clipboard (Ctrl+C) or paste an image/file path from the clipboard (Ctrl+V).
-
Minimalist Interface:
- Borderless window for a distraction-free experience, with dynamic cursor feedback for resizing.
- Displays "Right click to see hotkeys" when no image is loaded, using GDI text rendering.
-
Window Control:
- Supports window dragging (non-full-screen) and edge-based resizing.
- Toggles full-screen mode (F11 or context menu) with automatic image fitting, preserving window state.
- Exits via Esc or context menu, ensuring clean resource deallocation.
-
Single-Instance Enforcement:
- Uses
FindWindowWto prevent multiple instances, forwarding command-line arguments to the existing instance viaWM_COPYDATAfor memory management.
- Uses
Minimal Image Viewer is designed for OpSec-sensitive environments, prioritizing a minimal attack surface and zero telemetry.
-
Offline Operation:
- No network activity or telemetry, ensuring complete data privacy.
-
Minimal Attack Surface:
- The modular codebase is easy to audit. It relies exclusively on hardened, native Windows APIs and WIC, avoiding third-party library dependencies.
- Strict memory management mitigates buffer overflows and leaks, validated with static analysis tools.
-
Safe File Handling:
- Opens files with shared access (
FILE_SHARE_READ | FILE_SHARE_WRITE) to prevent lock-based exploits. - Saves via temporary files to ensure atomic writes, minimizing data loss risks.
- Deletes to Recycle Bin with user confirmation, preventing accidental permanent data loss.
- Opens files with shared access (
-
No Registry Modifications:
- Operates without persistent system changes, leaving no forensic footprint beyond the executable.
Minimal Image Viewer adheres to the Unix philosophy of “do one thing and do it well,” offering distinct advantages:
- Efficiency: Minimal resource usage (<10 MB RAM, ~100 KB disk) enables integration into resource-constrained workflows, outperforming bloated alternatives like Windows Photos (~100 MB RAM).
- Security: Focused functionality reduces attack vectors compared to feature-heavy tools with cloud integration or telemetry (e.g., Windows Photos, Adobe Bridge).
- Flexibility: Complements specialized tools (e.g., ExifTool, RawTherapee) for workflows in photography, digital forensics, or development.
- Maintainability: Small codebase simplifies updates, security patches, and community contributions.
| Feature | Minimal Image Viewer | Windows Photos | IrfanView | XnView |
|---|---|---|---|---|
| Executable Size | ~0.18 MB | ~50 MB | ~3 MB | ~5 MB |
| Dependencies | None (Windows APIs) | UWP Framework | Optional Plugins | Optional Plugins |
| Telemetry | None | Yes | Optional | Optional |
| Offline Operation | Yes | Partial | Yes | Yes |
| Image Format Support | WIC-dependent (all formats) | Codec-dependent | Plugin-dependent | Plugin-dependent |
| Open-Source | Yes | No | No | No |
| Footprint (RAM) | <10 MB | ~100 MB | ~20 MB | ~30 MB |
Minimal Image Viewer excels in size, privacy, and format support, leveraging WIC’s extensibility for unparalleled compatibility.
- OS: Windows 10 or later (64-bit recommended for optimal WIC codec support).
- Dependencies: None (uses standard Windows libraries:
user32,gdi32,windowscodecs, etc.). - Image Format Support: Supports all WIC-compatible formats; advanced formats (e.g., WebP, HEIF, AVIF) require installed codecs (e.g., Microsoft Store extensions).
- Disk Space: 400 KB.
- Memory: <10 MB runtime for typical images, scaling with image resolution.
-
See the release page for single .exe, or build yourself (instructions below).
-
Controls:
- Open: Ctrl+O or right-click → "Open Image".
- Navigate: Left/Right arrows or right-click → "Next/Previous Image."
- Zoom: Ctrl++/-, mouse wheel, or right-click → "Zoom In/Out"; Ctrl+0 or double-click to fit.
- Rotate: Up/Down arrows or right-click → "Rotate Clockwise/Counterclockwise."
- Save: Ctrl+S or right-click → "Save Image" (preserves original format).
- Delete: Delete or right-click → "Delete Image" (to Recycle Bin).
- Full-Screen: F11 or right-click → "Full Screen."
- Move/Resize: Drag window or edges (non-full-screen).
- Exit: Esc or right-click → "Exit."
- Copy: Ctrl+c.
- Paste: Ctrl+v
-
If you are having difficulties setting as your main image viewer, see setting as default viwer.
Minimal Image Viewer is architected for high performance, minimal resource usage, and robust security, leveraging native Windows technologies.
-
Windows API:
- Creates a borderless window, minimizing UI overhead.
- Implements double buffering for flicker-free rendering at 60+ FPS.
- Supports edge-based resizing with dynamic cursor updates, disabled in full-screen mode for seamless viewing.
-
Windows Imaging Component (WIC):
- Decodes images with
IWICBitmapDecoderandIWICBitmapFrameDecode, usingnullptrGUID to support all WIC-compatible formats dynamically. - Converts to
GUID_WICPixelFormat32bppPBGRAviaIWICFormatConverterfor GDI compatibility, ensuring consistent rendering across formats. - Applies rotations with
IWICBitmapFlipRotator, leveraging hardware acceleration for 90° increments. - Saves images using
IWICBitmapEncoder, dynamically selecting the original container format (decoder->GetContainerFormat) to preserve file type fidelity. - Validates directory files as images by attempting
IWICBitmapDecodercreation, ensuring broad format support without hardcoded extensions.
- Decodes images with
-
Graphics and Transformations:
- Renders images with
StretchBltinHALFTONEmode for high-quality scaling, optimized for various display DPIs. - Applies zoom and rotation via
SetWorldTransform, centering images using matrix transformations for precise positioning. - Uses
CreateDIBSectionfor direct pixel access, minimizing memory overhead (<10 MB for typical images).
- Renders images with
-
File System Operations:
- Indexes directory images with
FindFirstFileWandFindNextFileWusing a*.*wildcard, filtering via WIC’sIsImageFilefunction for format-agnostic support. - Opens files with
FILE_SHARE_READ | FILE_SHARE_WRITEandSTGM_SHARE_DENY_NONEto prevent access conflicts, even in multi-process environments. - Deletes to Recycle Bin with
SHFileOperationWandFOF_ALLOWUNDO, ensuring recoverable file operations. - Saves images atomically using temporary files (
MoveFileExWwithMOVEFILE_REPLACE_EXISTING) to handle file locks robustly.
- Indexes directory images with
-
Minimal Footprint:
- Compiles to a ~185 KB executable with
/O2optimization, requiring <10 MB runtime memory for most images. - No external dependencies beyond standard Windows libraries (
user32.lib,gdi32.lib,windowscodecs.lib, etc.).
- Compiles to a ~185 KB executable with
-
Resource Management:
- Strictly manages WIC (
Release) and GDI (DeleteObject) resources to prevent memory leaks, verified with tools like Application Verifier. - Closes file handles (
CloseHandle) immediately after use to ensure system resource availability. - Uses
FindWindowWto prevent multiple instances, forwarding command-line arguments to the existing instance viaWM_COPYDATAfor memory management.
- Strictly manages WIC (
- Tools: Microsoft C++ compiler (
cl.exe) and Resource Compiler (rc.exe)). - Resources: Links
minimallogo.icoviaresource.rcfor custom branding. - Build Commands:
- Visual Studio:
rc.exe /fo resource.res resource.rc cl.exe /O2 /EHsc /Fe:MinimalImageViewer.exe main.cpp ui_handlers.cpp image_drawing.cpp image_io.cpp resource.res /link /SUBSYSTEM:WINDOWS user32.lib gdi32.lib comdlg32.lib shlwapi.lib windowscodecs.lib ole32.lib shell32.lib propsys.lib oleaut32.lib
- Visual Studio:
Contributions are welcome.
To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/YourFeature). - Commit changes (
git commit -m "Add YourFeature"). - Push to the branch (
git push origin feature/YourFeature). - Open a pull request, ensuring alignment with the project’s minimalist and security-focused philosophy.
Include unit tests (e.g., for new WIC format handling) and update documentation for new features.
Minimal Image Viewer: A fast, secure, and extensible image viewer for privacy-conscious professionals.
