HarunOr/zCrop
A simple image cropping tool with zoom support, built in Zig
A simple image cropping tool built with Zig. And C libraries. Ok, it's mostly C.
A cropped image of an image demonstrating how to crop an image with zCrop.
# Arch Linux
sudo pacman -S sdl2
# Ubuntu/Debian
sudo apt install libsdl2-dev
# macOS
brew install sdl2
# Windows (vcpkg)
vcpkg install sdl2
# Using Make (recommended)
make # Build optimized release binary
make debug # Build debug binary
make test # Run tests
make run IMG=photo.png # Build and run with image
make install # Install to ~/.local/bin
make clean # Remove build artifacts
# Using Zig directly
zig build -Doptimize=ReleaseSmall # Optimized (~130KB)
zig build # Debug build
zig build test # Run tests
zig build run -- path/to/image.png # Build and run
zcrop image.png
# or
./zig-out/bin/zcrop image.png
| Key/Action | Description |
|---|---|
| Mouse drag | Draw a new crop rectangle or resize existing one |
| Drag inside | Move the crop rectangle |
| Drag corners/edges | Resize the crop rectangle |
| Ctrl + Scroll | Zoom in/out at cursor position |
| Scroll | Pan vertically (when zoomed in) |
| Shift + Scroll | Pan horizontally (when zoomed in) |
| 0 | Reset zoom to fit window |
| Enter | Crop and save, then exit |
| R | Reset crop to full image |
| Escape | Quit without saving |
The cropped image is saved as originalname_cropped.ext in the same directory.
MIT