Convert all kinds of images (JPG, PNG, BMP, HEIC, etc.) to WebP format via command-line.
- 🔁 Supports JPG, PNG, BMP, TIFF, GIF, and HEIC formats
- 📁 Converts a single directory or recursively scans subdirectories
- 🗑️ Option to delete original files after conversion
- 🪵 Logging with optional file output
- ❌ Robust error handling and skipping invalid files
First, set up a virtual environment and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
For Linux systems with HEIC support:
sudo apt install libheif-dev libde265-dev
python images2webp.py <input_dir> <output_dir> [options]
Option | Description |
---|---|
-r, --recursive |
Recursively scan input directories |
-d, --delete |
Delete original files after convert |
-l, --logfile |
Write logs to a specified file |
python images2webp.py ./images ./webp --recursive --delete --logfile convert.log
MIT License - see LICENSE for details.
© 2025 Max Base