imgopt-cli
The Intelligent WebP Converter for Modern Web Development.
imgopt is a high-performance, accessibility-first CLI tool designed to batch convert and optimize images (PNG, JPG, TIFF) into the efficient WebP format. It utilizes concurrency to process thousands of images in seconds and features a smart resizing engine that preserves aspect ratios.
Features ✨
- ⚡ Fast: Uses multi-core processing (
ProcessPoolExecutor) to utilize 100% of your CPU power. - 🧠 Smart: Auto-resizes images to a standard web width (default 1920px) without distortion. Prevents quality loss by retaining the original file if the WebP conversion results in a larger file size.
- 👀 Watcher Mode: Automatically monitors a directory and processes new images on the fly.
- 🤖 Auto-Configuration: Remembers your preferences using a hidden
.imgoptrcfile in your home directory, eliminating the need to repeatedly type CLI flags. - 🔍 Recursive: Automatically scans all subfolders and replicates the structure in the output.
- 🛡️ Safe: Never overwrites your original files. Creates a separate folder for optimized images. Includes a
--dry-runmode to safely simulate processing. - ♿ Accessible: Optimized for screen readers (NVDA/JAWS) using clean, sequential logging and optional audio cues upon completion.
- 🧙♂️ Wizard Mode: Don't like memorizing commands? Run
imgoptwithout arguments to enter an interactive, step-by-step wizard.
Installation 📦
You can install imgopt easily using pip or uv:
Option 1: Using pip (Standard)
pip install imgopt-cli
Option 2: Using uv (Recommended for speed)
uv tool install imgopt-cli
Note: The package name is imgopt-cli, but the command you run is simply imgopt.
Usage 🛠️
-
Interactive Wizard (Recommended for beginners): Just run the command without arguments. The tool will guide you step-by-step and save your preferences. imgopt
-
Quick CLI Mode (For Pros): Optimize a folder immediately using your saved config or default settings. imgopt ./photos
-
Watch Mode: Keep the script running to instantly optimize any new images dropped into the directory. imgopt ./assets --watch
-
Dry Run Simulation: Test the optimization logic without writing any files to disk. imgopt ./photos --dry-run
-
No Resizing: Keep original image dimensions. imgopt ./photos -w 0
-
Custom Overrides: Override the default quality and output folder. imgopt ./raw_images --output ./web_ready --quality 90
-
Silent Mode: Suppress detailed logs, perfect for automated scripts. imgopt ./assets --quiet --no-sound
Options ⚙️
-i, --interactive: Force the interactive wizard mode.-q, --quality: Set WebP quality (0-100). Default is 80 or your.imgoptrcsetting.-w, --width: Max width in pixels. Use 0 to keep original dimensions. Default is 1920 or your.imgoptrcsetting.-o, --output: Custom name for the output folder. Default isoptimized_webpor your.imgoptrcsetting.--watch: Watch the directory for new images and process them in the background.--dry-run: Simulate the optimization process without saving any files.--quiet: Suppress per-file logs (shows only the final summary).--no-sound: Disable the "beep" notification sound at the end.--version: Show the current tool version.-h, --help: Display the detailed help menu.
Requirements
- Python 3.8+
- Pillow (Installed automatically)
- Watchdog (Installed automatically)
License
This project is licensed under the MIT License. See LICENSE for details.
Support 💖
If you find this tool useful, please consider giving it a ⭐ on GitHub!
Metadata
Release files for imgopt-cli 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| imgopt_cli-1.1.0.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| imgopt_cli-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / imgopt_cli-1.1.0.tar.gz
| Download URL | imgopt_cli-1.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b08fa24ff204942cefca661dc034d35c31da60d6ea1b3c15b478381f789fc15d
|
|
BLAKE2b-256 checksum How to use checksums |
860e245a7eb3d0c7269451cf8c33f47cfaecec43321355cf07edd1fb0f0ef402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / imgopt_cli-1.1.0-py3-none-any.whl
| Download URL | imgopt_cli-1.1.0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2797f1faee110e3b7935d3defaf4a2c5165a51cecf551e48465d87a1a937a306
|
|
BLAKE2b-256 checksum How to use checksums |
2357a1eb239f8e3d71b891da2d1796a0967d794d6a2338d16646b5790c7c5a52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|