slimg-0.4.0 is not a library.
slimg
A fast image optimization CLI. Convert, compress, resize, crop, and extend images using modern codecs.
Supported Formats
| Format | Decode | Encode | Notes |
|---|---|---|---|
| JPEG | Yes | Yes | MozJPEG encoder for superior compression |
| PNG | Yes | Yes | OxiPNG optimizer with Zopfli compression |
| WebP | Yes | Yes | Lossy encoding via libwebp |
| AVIF | Yes | Yes | ravif encoder; dav1d decoder (statically linked) |
| QOI | Yes | Yes | Lossless, fast encode/decode |
| JPEG XL | Yes | No | Decode-only (GPL license restriction) |
Installation
Cargo (crates.io)
cargo install slimg
Homebrew (macOS / Linux)
brew install clroot/tap/slimg
Pre-built binaries
Download from GitHub Releases:
| Platform | File |
|---|---|
| macOS (Apple Silicon) | slimg-aarch64-apple-darwin.tar.xz |
| macOS (Intel) | slimg-x86_64-apple-darwin.tar.xz |
| Linux (x86_64) | slimg-x86_64-unknown-linux-gnu.tar.xz |
| Linux (ARM64) | slimg-aarch64-unknown-linux-gnu.tar.xz |
| Windows (x86_64) | slimg-x86_64-pc-windows-msvc.zip |
From source
git clone https://github.com/clroot/slimg.git
cd slimg
cargo install --path cli
Build requirements
- Rust 1.85+ (edition 2024)
- C compiler (cc)
- nasm (for MozJPEG / rav1e assembly optimizations)
- meson + ninja (for building dav1d AVIF decoder from source)
- Set
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL=alwaysto build dav1d from source
Usage
For the full usage guide, see docs/usage.md.
# Convert format
# Optimize (re-encode in same format)
# Resize
# Crop by coordinates
# Crop to aspect ratio (center-anchored)
# Extend to square with padding
# Extend with transparent background
# Batch processing with format conversion
Benchmarks
See docs/benchmarks.md for detailed performance measurements across all codecs and pipeline operations.
Language Bindings
| Language | Package | Platforms |
|---|---|---|
| Kotlin/JVM | io.clroot.slimg:slimg-kotlin |
macOS, Linux, Windows |
| Python | slimg |
macOS, Linux, Windows |
Library
The core functionality is available as a library crate (slimg-core):
use *;
// Decode an image file
let = decode_file?;
// Convert to WebP
let result = convert?;
// Save the result
result.save?;
License
MIT