A tool to convert images to WebP with a target file size.
Project description
img-scale-to-webp
A simple and efficient command-line tool to convert images in a folder to the WebP format, aiming for a specific target file size. It also backs up the original images.
Features
- Batch Conversion: Convert all images in a folder at once.
- Target Size: Aims to create WebP images around a specified file size in KB.
- Resize: Optionally resize images to a maximum width.
- Recursive: Process images in subfolders.
- Backup: Automatically backs up original images to a separate folder.
- Supported Formats:
.jpg,.jpeg,.png,.tif,.tiff,.bmp
Installation
You can install img-scale-to-webp from PyPI:
pip install img-scale-to-webp
Usage
The basic command is straightforward:
img-scale-to-webp --folder /path/to/your/images
Examples
1. Convert images in a folder to a target size of 500 KB:
img-scale-to-webp --folder "My_Photos" --target-kb 500
2. Convert images and resize them to a maximum width of 1200 pixels:
img-scale-to-webp --folder "My_Photos" --max-width 1200
3. Recursively convert all images in a folder and its subfolders:
img-scale-to-webp --folder "My_Photos" --recursive
Command-line Options
| Argument | Description | Default |
|---|---|---|
--folder |
Required. The folder containing the images. | |
--target-kb |
The target size for each image in kilobytes. | 1024 |
--max-width |
Optional maximum width to resize images. Set to 0 to disable. | 1920 |
--recursive |
Process images in subfolders. | False |
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file img_scale_to_webp-1.0.0.tar.gz.
File metadata
- Download URL: img_scale_to_webp-1.0.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4b1994ecd2b9b83b17c8a316a3f38f5f1311f78f789d071135148579e63e4f
|
|
| MD5 |
559bc138c72944515de0450b78d59cfe
|
|
| BLAKE2b-256 |
7281e45a93d5bde0269a79d2dbad52d23f37e6569734f70a59b075a62e0d96bc
|
File details
Details for the file img_scale_to_webp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: img_scale_to_webp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72ee6ed1b7a9b4dfbc9ad1bfb7338aa98342cabae58a7931e026aff040d32449
|
|
| MD5 |
12d2e9d33b508b9ceaab07581134bcf4
|
|
| BLAKE2b-256 |
0c83334bc17e2256cf1adab6f241c8573e1ad5c66321c271ad340c4c104ee069
|