grassleaff/sVisualizer
A SDL2 lightweight and simple image visualizer written in C
- C 80.5%
- Makefile 19.5%
| assets | ADD: New sv.png | |
| desktop | A lot of things added, gg | |
| .gitignore | Modifying .gitignore | |
| config.h | ADD/FIX: New smooth scaling with linear filtering for medium/high resolution images + fix mouse scroll offset | |
| LICENSE | Add GNU GPL2 License, a Makefile and more to main.c | |
| main.c | ADD/FIX: New smooth scaling with linear filtering for medium/high resolution images + fix mouse scroll offset | |
| Makefile | ADD [MAJOR UPDATE]: Add info bar, OS-native file picker and display improvements | |
| README.md | ADD/FIX: New smooth scaling with linear filtering for medium/high resolution images + fix mouse scroll offset | |
accessibility text
A lightweight command-line image viewer built with SDL2.
Features
- Zoom in and out with the keyboard or mouse scroll wheel
- Zoom follows the mouse cursor position
- Pan with arrow keys or by clicking and dragging
- Bottom info bar showing filename, dimensions, format, and zoom level (toggle with
t) - Fit-to-window mode that automatically scales the image when the window is resized (toggle with
w) - Fullscreen mode (toggle with
f) - Native OS file picker dialog when no image path is provided
- Borderless window
- Adaptive scaling: nearest-neighbor for very small source images, linear filtering for medium/high resolution images
Supported Formats
| Format | Notes |
|---|---|
| JPEG | Requires libjpeg |
| PNG | Requires libpng |
| GIF | Built-in (static, first frame only) |
| TIFF | Requires libtiff |
| WEBP | Requires libwebp |
| BMP, ICO, XPM, PCX, PNM | Built-in |
Controls
| Input | Action |
|---|---|
+ / = |
Zoom in |
- |
Zoom out |
| Scroll wheel | Zoom in/out (centered on cursor) |
| Arrow keys | Pan |
| Left click + drag | Pan |
r |
Reset view |
w |
Toggle fit-to-window |
f |
Toggle fullscreen |
t |
Toggle info bar |
q |
Quit |
Dependencies
Building
Linux
# Debian/Ubuntu
sudo apt install gcc libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
# Arch
sudo pacman -S gcc sdl2 sdl2_image sdl2_ttf
# Fedora
sudo dnf install gcc SDL2-devel SDL2_image-devel SDL2_ttf-devel
make
macOS
brew install sdl2 sdl2_image sdl2_ttf
make
Windows (MSYS2)
pacman -S mingw-w64-x86_64-gcc \
mingw-w64-x86_64-SDL2 \
mingw-w64-x86_64-SDL2_image \
mingw-w64-x86_64-SDL2_ttf
make
To generate a self-contained folder with the binary and all required DLLs:
make bundle
Installation
sudo make install # installs to /usr/local/bin
sudo make uninstall
Supports DESTDIR for packaging:
make install DESTDIR=/tmp/pkg PREFIX=/usr
Usage
sv image.png
sv # opens native file picker
Debug Build
make DEBUG=1
License
GNU GPLv2 License — Copyright (c) 2025 grassleaff. All Rights Reserved.