Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img_scale_to_webp-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

img_scale_to_webp-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

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

Hashes for img_scale_to_webp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9d4b1994ecd2b9b83b17c8a316a3f38f5f1311f78f789d071135148579e63e4f
MD5 559bc138c72944515de0450b78d59cfe
BLAKE2b-256 7281e45a93d5bde0269a79d2dbad52d23f37e6569734f70a59b075a62e0d96bc

See more details on using hashes here.

File details

Details for the file img_scale_to_webp-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for img_scale_to_webp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72ee6ed1b7a9b4dfbc9ad1bfb7338aa98342cabae58a7931e026aff040d32449
MD5 12d2e9d33b508b9ceaab07581134bcf4
BLAKE2b-256 0c83334bc17e2256cf1adab6f241c8573e1ad5c66321c271ad340c4c104ee069

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page