Python Image to WEBP
Project description
PyWebp: Image to WebP Converter
Pywebp is a versatile command-line tool written in Python for converting images to the WebP format. WebP offers superior lossless and lossy compression, enabling smaller, richer images that enhance web performance.
Key Features
- Ease of Use: Convert single images or entire directories with simple commands.
- Versatility: Options for recursive processing and maintaining directory structure.
- Quality Control: Adjust output quality, optimize, and resize images.
- Advanced Features:
- Multithreading for faster processing of large batches.
- Verbose output for detailed feedback or quiet mode for minimal output.
- Unlink input images after processing to manage disk space.
Whether you're a web developer optimizing site images or a photographer converting your portfolio, Pywebp provides a comprehensive solution for your image conversion needs.
Arguments
Positional Parameters
input: Input directory. Default is the current directory.output: Output directory. Default is the current directory.
Options
resize: Resize image to the given size. e.g., 640x800.min-width: Skips images that are smaller than the given width.min-height: Skips images that are smaller than the given height.max-width: Skips images that are larger than the given width.max-height: Skips images that are larger than the given height.keep-aspect-ratio: Keep the original aspect ratio while resizing. Default is True.files-format: Input files format. e.g., png, jpg, jpeg.quality: Integer, 0-100. For lossy, 0 gives the smallest size and 100 the largest. For lossless, this parameter is the amount of effort put into the compression: 0 is the fastest, but gives larger files compared to the slowest, but best, 100. Default is 80.alpha-quality: Integer, 0-100. For lossy compression only. 0 gives the smallest size and 100 is lossless. Default is 100.lossless: Enable lossless compression. Default is False.method: Quality/speed trade-off (0=fast, 6=slower-better). Default is 4.exact: If true, preserve the transparent RGB values. Otherwise, discard invisible RGB values for better compression. Default is False.keep-directory: Keep the directory structure of the input. Default is True.recursive: Convert images in subdirectories. Default is False.use-threads: Use multiple threads. Default is False.threads: Number of threads to use. None = Max possible (4 * N of cores, limited to 32).unlink: Unlink/delete the input files. Default is False.ignore-existing: Ignore existing files. Default is True.
Usage
To convert images using Pywebp, you can use the following command:
pywebp convert ./input_directory ./output_directory --resize 640x800 --quality 90 --lossless --recursive
This command will:
- Convert all images in the ./images directory to WebP format.
- Resize the images to 640x800 pixels.
- Set the quality of the output images to 90.
- Enable lossless compression.
- Process images in subdirectories of the ./images directory.
You can adjust the parameters as needed to fit your specific use case.
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 python_webp-2.0.1.tar.gz.
File metadata
- Download URL: python_webp-2.0.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9da4cf93fed2f67f2e52174f90e09a5bcb3d442307c2507967da6a63f1390574
|
|
| MD5 |
bf2145fa1544f1359d45e9a8adf5127b
|
|
| BLAKE2b-256 |
3b38657ee9510a49c3ee00b79ba55ea8a5920596cf533c5981baf653e3909a7b
|
Provenance
The following attestation bundles were made for python_webp-2.0.1.tar.gz:
Publisher:
release.yml on biellSilva/python-webp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_webp-2.0.1.tar.gz -
Subject digest:
9da4cf93fed2f67f2e52174f90e09a5bcb3d442307c2507967da6a63f1390574 - Sigstore transparency entry: 153073461
- Sigstore integration time:
-
Permalink:
biellSilva/python-webp@aa16067edff6be5e8c53f1edf37b76b6fca71c00 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/biellSilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aa16067edff6be5e8c53f1edf37b76b6fca71c00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_webp-2.0.1-py3-none-any.whl.
File metadata
- Download URL: python_webp-2.0.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29ba6dcda167fdff5e533e16ddc2905993ca5c7896fafce5c1bef908a3744a47
|
|
| MD5 |
92f9eca67fa4e80fec038839bdf43ff0
|
|
| BLAKE2b-256 |
dfdfd4b41ac8f346c10b56634458002fe70aab984c0442a86dc464947fed26be
|
Provenance
The following attestation bundles were made for python_webp-2.0.1-py3-none-any.whl:
Publisher:
release.yml on biellSilva/python-webp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_webp-2.0.1-py3-none-any.whl -
Subject digest:
29ba6dcda167fdff5e533e16ddc2905993ca5c7896fafce5c1bef908a3744a47 - Sigstore transparency entry: 153073462
- Sigstore integration time:
-
Permalink:
biellSilva/python-webp@aa16067edff6be5e8c53f1edf37b76b6fca71c00 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/biellSilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aa16067edff6be5e8c53f1edf37b76b6fca71c00 -
Trigger Event:
push
-
Statement type: