tool-webp-converter
A Python tool for optimal WebP image compression that automatically chooses between lossless and lossy compression to achieve the smallest file size.
Why WebP?
WebP is a modern image format developed by Google that provides superior compression for images on the web. It offers:
- Better compression: 25-35% smaller file sizes compared to JPEG and PNG
- Lossless and lossy compression: Choose the best compression method for your needs
- Transparency support: Like PNG, but with better compression
- Animation support: Similar to GIF but with much smaller file sizes
- Wide browser support: Supported by all modern browsers
Installation
Install the package from PyPI:
pip install tool-webp-converter
Usage
The tool provides a command-line interface for converting images to WebP format. It automatically tests both lossless and lossy compression and saves the smaller file.
Basic Usage
Convert a single image:
webp-converter image.jpg
Convert all images in a directory:
webp-converter /path/to/images/
Command Line Options
webp-converter [OPTIONS] INPUT_PATH
Arguments:
INPUT_PATH: Path to the input image file or directory
Options:
-o, --output-dir PATH: Output directory (defaults to input file directory)-q, --quality INTEGER: Quality for lossy compression (1-100, default: 80)-v, --verbose: Enable verbose logging-r, --recursive: Process directories recursively
Examples
Convert a single image with custom quality:
webp-converter photo.jpg --quality 90
Convert all images in a directory to a specific output folder:
webp-converter /path/to/images/ --output-dir /path/to/output/
Process a directory recursively (including subdirectories):
webp-converter /path/to/images/ --recursive
Supported Formats
The tool supports the following input formats:
- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- TIFF (.tiff, .tif)
- GIF (.gif)
- WebP (.webp)
How It Works
- Dual Compression: The tool creates both lossless and lossy WebP versions
- Automatic Selection: It automatically saves the smaller file
- Quality Control: You can adjust the quality for lossy compression (1-100)
- Batch Processing: Process single files or entire directories
- Recursive Support: Optionally process subdirectories
Output
The tool provides detailed feedback including:
- Compression statistics (original vs compressed size)
- Percentage reduction achieved
- Total space saved for batch operations
- Error reporting for failed conversions
Development
This project uses Poetry for dependency management. To set up the development environment:
# Install dependencies
poetry install
# Activate virtual environment
poetry shell
# Run the tool
python -m tool_webp_converter.cli image.jpg
Metadata
Release files for tool-webp-converter 0.2.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 | Provenance | |
|---|---|---|---|---|
| tool_webp_converter-0.2.0.tar.gz | 7.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tool_webp_converter-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.1 kB
Release files / tool_webp_converter-0.2.0.tar.gz
| Download URL | tool_webp_converter-0.2.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98dadaadd03b0c2fda4e440b77eca16ac8213b45e42f1faea3a3013601f2fa49
|
|
BLAKE2b-256 checksum How to use checksums |
bef3bf1ac00ce48ab77b324dfdb3443af336cc6a62726f723282042e27109b60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tool_webp_converter-0.2.0-py3-none-any.whl
| Download URL | tool_webp_converter-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ef9bd20980b6a805875c407d1435b286284d24c2928000fbe0693f31d379569
|
|
BLAKE2b-256 checksum How to use checksums |
9b9c2f563e3ad91ecc54d00933e89a660d61990b7afc2eda70c510276220bec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for tool-webp-converter 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.