Metadata-Version: 2.4
Name: imgopt-cli
Version: 1.1.0
Summary: A high-performance CLI tool with directory watching to batch optimize images into WebP format.
Author: Ahmed Samy El-khouly
License: MIT License
        
        Copyright (c) 2025 Ahmed Samy El-khouly
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/ahmedthebest31/imgopt
Project-URL: Bug Tracker, https://github.com/ahmedthebest31/imgopt/issues
Keywords: image,optimization,webp,cli,converter,watchdog,batch
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Pillow>=10.3.0
Requires-Dist: watchdog>=4.0.2
Dynamic: license-file

# imgopt-cli

[![PyPI version](https://badge.fury.io/py/imgopt-cli.svg)](https://badge.fury.io/py/imgopt-cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python Versions](https://img.shields.io/pypi/pyversions/imgopt-cli.svg)](https://pypi.org/project/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 `.imgoptrc` file 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-run` mode 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 `imgopt` without arguments to enter an interactive, step-by-step wizard.

## Installation 📦

You can install `imgopt` easily using `pip` or `uv`:

### Option 1: Using pip (Standard)
```bash
pip install imgopt-cli
```

### Option 2: Using uv (Recommended for speed)
```bash
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 `.imgoptrc` setting.
* `-w, --width`: Max width in pixels. Use 0 to keep original dimensions. Default is 1920 or your `.imgoptrc` setting.
* `-o, --output`: Custom name for the output folder. Default is `optimized_webp` or your `.imgoptrc` setting.
* `--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!
