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.txtFor Linux systems with HEIC support:
sudo apt install libheif-dev libde265-devpython 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.logMIT License - see LICENSE for details.
ยฉ 2025 Max Base