Compress thousands of images in seconds with blazing-fast parallel processing
RAW images often consume massive amounts of storage space, making organization and archiving challenging. Compressor solves this problem by leveraging parallel processing to compress large batches of images efficiently, reducing file sizes dramatically without noticeable quality loss.
- 🚀 Blazing Fast - Parallel processing fully utilizes your CPU cores
- 📦 Batch Processing - Handle thousands of images effortlessly
- 🎯 Smart Output - Auto-generates organized folder structures
- 🔄 Format Flexible - Supports JPG, PNG, WebP conversion
- 🛡️ Safe & Reliable - Smart duplicate handling and error recovery
- 🌍 Cross-Platform - Works on Linux, macOS, and Windows
| Feature | Description |
|---|---|
| 🖥️ CLI Interface | Simple command-line interface for easy automation |
| ⚡ Parallel Processing | Customizable thread count for optimal performance |
| 🔍 Recursive Scanning | Automatically processes all images in subdirectories |
| 📂 Smart Output | Auto-generates organized output folders or use custom paths |
| 🔄 Duplicate Handling | Intelligent renaming when file conflicts occur |
| 🎨 Quality Control | Adjustable compression quality (0-100) |
| 📥 Format Filtering | Specify which input formats to process |
| 📤 Format Conversion | Convert to JPG, PNG, or WebP |
| 📊 Detailed Logging | Comprehensive operation logs and statistics |
| 🛡️ Error Handling | Robust exception handling for uninterrupted processing |
| 🌐 Cross-Platform | Native support for Linux, macOS, and Windows |
Using Go:
go install github.com/bipy/compressor@latestFrom Source:
git clone https://github.com/bipy/compressor.git
cd compressor
go build -o compressor# Compress images with 16 threads at quality 80
compressor -i ~/Pictures -j 16 -q 80
# Compress a single file
compressor -i ~/Pictures/photo.png
# Convert to WebP format
compressor -i ~/Pictures -t webp -q 75
# Show help
compressor -hInput folder: ~/Pictures/my-photos
The program automatically generates a unique ID and creates an organized output structure:
📁 ~/Pictures/my-photos → 📁 ~/Pictures/my-photos-1700457797
📁 part1 → 📁 part1
🖼️ test.png → 🖼️ test.jpg
🖼️ haha.png → 🖼️ haha.jpg
All images in subdirectories are processed automatically:
📁 Input 📁 Output
~/Pictures/my-photos/part1/test.png → ~/Pictures/my-photos-1700457797/part1/test.jpg
~/Pictures/my-photos/haha.png → ~/Pictures/my-photos-1700457797/haha.jpg
When duplicate filenames are detected, automatic renaming kicks in:
~/Pictures/my-photos/haha.jpg → ~/Pictures/my-photos-1700457797/haha-1.jpg
~/Pictures/my-photos/haha.jpeg → ~/Pictures/my-photos-1700457797/haha-2.jpg
Usage: compressor [-h] [Options]
Options:
-h Show this help message
-i <path> Input path (file or directory)
-o <path> Output path (optional, auto-generated if not specified)
-j <number> Thread count for parallel processing (default: 8)
-q <0-100> Output quality (default: 90)
-t <format> Output format: jpg/jpeg/png/webp (default: jpg)
-accept <formats> Accepted input formats (default: "jpg jpeg png")
-width <pixels> Maximum image width (default: original size)
-height <pixels> Maximum image height (default: original size)
# High-quality compression with maximum threads
compressor -i ~/Photos -j 32 -q 95
# Convert PNG to WebP with size limit
compressor -i ~/Photos -t webp -width 1920 -height 1080
# Process only specific formats
compressor -i ~/Photos -accept "png jpg" -t jpg -q 85
# Specify custom output directory
compressor -i ~/Photos/raw -o ~/Photos/compressed -j 16- Scan - Recursively discovers all images in the input path
- Filter - Applies format filters based on
-acceptparameter - Process - Compresses images in parallel using worker threads
- Convert - Transforms to target format (JPG/PNG/WebP)
- Save - Writes compressed images to output directory
- Report - Displays compression statistics and results
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with:
- disintegration/imaging - Image processing
- go-webpbin - WebP support
- charmbracelet/log - Beautiful logging