png-resizer-1.0.0 is not a library.
png-resizer
High-performance PNG image resizer built with Rust and the fast_image_resize library.
Features
- ⚡ Blazing Fast: Uses SIMD instructions (AVX2, SSE4.1, NEON) + multithreading via Rayon
- 🎨 High Quality: Proper sRGB ↔ linear RGB color space conversion for accurate resizing
- 📦 Zero Dependencies: No external C libraries required (unlike libvips-based tools)
- 🔧 Easy to Use: Simple CLI interface with automatic aspect ratio preservation
- 💾 Memory Efficient: Optimized for processing large images
Installation
From crates.io
From source
Binary will be at ./target/release/png-resizer
Usage
Basic Usage (maintains aspect ratio automatically)
Specify both width and height
Choose resize algorithm
# Fastest (lower quality)
# High quality (default)
Disable multithreading
Command Line Arguments
Usage: png-resizer [OPTIONS] <INPUT> --output <OUTPUT> --width <WIDTH>
Arguments:
<INPUT> Input PNG file path
Options:
-o, --output <OUTPUT> Output PNG file path
-w, --width <WIDTH> Target width (pixels)
--height <HEIGHT> Target height (pixels). If not specified, maintains aspect ratio
-a, --algorithm <ALGORITHM> Resize algorithm [default: lanczos3] [possible values: nearest, bilinear, catmull, mitchell, lanczos3]
--no-threads Disable multithreading
-v, --version Show version information
-h, --help Print help
Resize Algorithms
| Algorithm | Speed | Quality | Best For |
|---|---|---|---|
nearest |
⚡⚡⚡⚡⚡ | ⭐ | Pixel art, extremely fast preview |
bilinear |
⚡⚡⚡⚡ | ⭐⭐⭐ | General use, good speed/quality balance |
catmull |
⚡⚡⚡ | ⭐⭐⭐⭐ | Smooth edges, natural looking |
mitchell |
⚡⚡⭐ | ⭐⭐⭐⭐ | Balanced sharpness and smoothness |
lanczos3 |
⚡⚡ | ⭐⭐⭐⭐⭐ | Best quality (default, recommended) |
Examples
Resize maintaining aspect ratio
Create thumbnail
Batch processing
# Bash/Linux
for; do
done
# PowerShell
|
Different quality levels
# Maximum quality (slower)
# Fast processing (lower quality)
Performance
This tool uses fast_image_resize, which is one of the fastest image resizing libraries available:
- vs ImageMagick: ~3-5x faster
- vs Pillow (Python): ~4-6x faster
- vs Go standard library: ~2-3x faster
Performance comes from:
- SIMD vectorization (processes multiple pixels simultaneously)
- Multi-core utilization via Rayon
- Optimized memory access patterns
- Zero-copy operations where possible
Technical Details
Why fast_image_resize?
fast_image_resize provides:
- Proper color space handling (sRGB ↔ linear RGB conversion)
- Multiple high-quality resize algorithms
- SIMD support for x86-64 (AVX2, SSE4.1) and ARM (NEON)
- Thread-safe parallel processing
- No external C library dependencies
Aspect Ratio Preservation
When --height is not specified, the tool automatically calculates the height to maintain the original image's aspect ratio:
new_height = original_height × (new_width / original_width)
Alternative Tools
If you need additional features, consider:
- Rimage: Full-featured image optimization CLI (also uses
fast_image_resize) - ImageMagick: Feature-rich but slower
- libvips: Fast but requires C library installation
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
👤 Author
Acknowledgments
- Built with fast_image_resize by Kirill Kuzminykh
- Uses the excellent image crate for PNG encoding/decoding
- CLI powered by clap
