A lightweight, high-performance command-line tool for batch image optimization.
IMP streamlines the process of reducing file sizes for web usage or storage archiving while maintaining visual quality. Built with Python, it supports smart compression, WebP conversion, and intelligent resizing—all in one simple CLI.
- 🎨 Smart Compression - Efficiently compresses JPG and PNG files to reduce footprint
- 🌐 Modern Formats - One-flag conversion to WebP for superior compression
- 📂 Batch Processing - Recursively scans directories to process thousands of images in one go
- 🛡️ Safety First - Automatically backs up original files to an
originals/directory before modification - 📐 Intelligent Resizing - Resize images to specific dimensions while preserving aspect ratio
- 📊 Progress Tracking - Visual progress bar with detailed statistics on space saved
The easiest way to install IMP on macOS:
brew install SamSeenX/apps/impThat's it! You can now use imp from anywhere in your terminal.
# Clone the repository
git clone https://github.com/SamSeenX/imp-cli.git
cd imp-cli
# Install dependencies
pip install -r requirements.txt
# Make executable and install
chmod +x imp
sudo cp imp /usr/local/bin/imp
# Verify installation
imp --helpgit clone https://github.com/SamSeenX/imp-cli.git
cd imp-cli
pip install -r requirements.txt
./imp ./photos# Optimize a single image
imp image.jpg
# Process all images in a folder
imp ./my-photos/| Option | Default | Description |
|---|---|---|
--webp |
false |
Convert images to WebP format |
--resize <SIZE> |
- | Resize so longest side is at most SIZE pixels |
--quality <1-100> |
69 |
Set compression quality level |
--pre |
false |
Preview changes without modifying any files |
--nr |
false |
Non-recursive: only process files in the top-level folder |
--rd |
false |
Recursive distributed: place originals folder in each subfolder |
--restore |
- | Restore original files and remove originals folders |
--backup <DEST> |
- | Move originals folders to specified backup location |
--clean |
- | Delete all originals folders to free up space |
# Basic Optimization (JPG, Quality 69%)
imp image.jpg
imp ./my-photos/
# Convert to WebP
imp ./gallery/ --webp
# Resize Images (longest side = 1920px)
imp ./wallpapers/ --resize 1920
# Custom Quality
imp photo.png --quality 85
# Combine Options (WebP + resize + quality)
imp ./assets/ --webp --resize 1080 --quality 75
# Preview changes without modifying files
imp ./photos/ --pre
imp ./assets/ --webp --resize 1080 --pre
# Non-recursive (only top-level folder)
imp ./photos/ --nr
# Distributed originals (each subfolder gets its own originals/)
imp ./photos/ --rdIMP is non-destructive by default. Original files are always backed up before modification.
| Mode | Flag | Behavior |
|---|---|---|
| Centralized (default) | - | Single originals/ folder at root with mirrored structure |
| Distributed | --rd |
Each subfolder gets its own originals/ subfolder |
| Non-recursive | --nr |
Only process top-level folder |
IMP provides built-in commands to manage your original files. These work on all operating systems (macOS, Linux, Windows).
Undo changes - Restore your original files:
imp <path> --restoreMove to backup - Archive originals to a backup location:
imp <path> --backup <destination>
# Example:
imp ./photos --backup ~/backupDelete originals - Free up space when you're happy with results:
imp <path> --cleanTip: These commands automatically find and process all
originals/folders, whether you used centralized (default) or distributed (--rd) mode.
imp-cli/
├── imp # Main CLI script (Python)
├── brew/ # Homebrew formula
├── requirements.txt # Python dependencies
├── setup.py # Package setup
├── assets/ # Demo screenshots
├── website/ # Landing page
├── LICENSE # MIT License
└── README.md
brew update && brew upgrade impcd imp-cli
git pull origin main- PNG to JPG conversion option
- HEIC support
- Dry-run mode to preview changes
- Output directory option
- WebP conversion
- Smart compression
- Batch processing
- Homebrew installation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Nice. But also, it provides a good balance between file size reduction and visual quality for most use cases.
No! IMP automatically backs up your originals to an originals/ subdirectory before making any changes. So if you want to keep the original files, you can just move them back from the originals/ directory.
Currently JPG, JPEG, and PNG files. All images are converted to JPG by default to ensure the smallest file size, or WebP if the --webp flag is used.
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this project useful, please consider supporting me:
- ⭐ Starring this repository
- 🐛 Reporting issues
- 💡 Suggesting improvements
- ☕ Buy me a coffee
Created with ❤️ by SamSeen
