webpall
webpall is a Python-based command-line tool designed to convert images in JPG and PNG formats to WebP format. It offers flexible options for quality settings, including or excluding subdirectories, and managing original files post-conversion. With WebP format, you can achieve smaller file sizes without significant loss in quality, making it an excellent choice for web optimization and storage management.
Features
- Selective File Type Conversion: Choose to convert only JPGs, only PNGs, or both file types.
- Quality Control: Adjust the WebP conversion quality from 1-100 (with 100 offering lossless compression).
- Delete Originals Option: Optionally delete original images after conversion to WebP format.
- Recursive Processing: Include subdirectories in the conversion process to handle large, nested image folders.
Installation
webpall is available on PyPI and can be installed using pip:
pip install webpall
Requirements
- Python 3.6 or later.
- Pillow library for image processing (automatically installed with
webpall).
Usage
After installing, you can use webpall from the command line to quickly convert images in a specified folder.
Default Behavior
If you run webpall without any options, it will:
- Convert all JPG and PNG images in the current directory to WebP format.
- Keep the original image files intact (i.e., they will not be deleted).
- Set the WebP conversion quality to 90%, providing high-quality compressed images.
To use this default behavior, run:
webpall
Basic Command Structure
webpall --dir <directory_path> [options]
Command-Line Options
| Option | Description | Default |
|---|---|---|
--dir <directory> |
Path to the folder containing images. | Current folder (.) |
--delete |
Deletes the original files after conversion. | Disabled |
--type <all|jpg|png> |
Specifies the type of images to convert: jpg, png, or all. |
all |
--quality <1-100> |
Sets the quality of the WebP conversion (100 is lossless). | 90 |
--subdirs or -s |
Includes subdirectories in the conversion process. | Disabled |
Examples
Here are some common usage examples to help you get started:
Example 1: Convert All Images in the Current Directory to WebP
webpall
This converts all JPG and PNG files in the current directory to WebP format, keeping the original files and using the default quality of 90%.
Example 2: Convert All Images in a Specific Directory with Custom Quality
webpall --dir /path/to/images --quality 80
This command converts all JPG and PNG images in /path/to/images to WebP with a quality setting of 80.
Example 3: Convert Only JPG Images and Delete the Original Files
webpall --dir /path/to/images --type jpg --delete
This will convert only JPG files to WebP in /path/to/images, deleting the original JPG files after conversion.
Example 4: Convert All Images in Subdirectories with Lossless Quality
webpall --dir /path/to/images --subdirs --quality 100
This command will convert all JPG and PNG images within /path/to/images and its subdirectories to WebP with lossless quality (100), retaining the original images.
Example Output
During the conversion process, webpall will display status messages for each file:
Starting conversion process...
Found 5 image files to convert.
Converted /path/to/image1.jpg to /path/to/image1.webp
Converted /path/to/image2.png to /path/to/image2.webp and deleted /path/to/image2.png
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Release files for webpall 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| webpall-0.1.2.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| webpall-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / webpall-0.1.2.tar.gz
| Download URL | webpall-0.1.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d21eba53e71de0b4f509eff02ee9b6abdc0b0c7c5305b5c682b05fdef7d5d0fc
|
|
BLAKE2b-256 checksum How to use checksums |
e6083b84bb9609cea60520a9857d859e013e8c1094394c0968048402ef8d9a81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / webpall-0.1.2-py3-none-any.whl
| Download URL | webpall-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5724bfab0ac4d5a17d58a5954cb629287dc3ede81b8f48d6bed27eb033f2d57
|
|
BLAKE2b-256 checksum How to use checksums |
099aed3019f47b577b9aa5b729c38fbf36efbb41173f093e0a6df0120dfe194e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|