/webp

Generate WebP copies of all valid images and GIFs in a directory.

Primary LanguagePythonMIT LicenseMIT

webp

A CLI tool that converts all valid images and GIFs in a directory (and all nested subdirectories) to WebP.

Getting Started

  1. Download webp.py.

  2. Run chmod a+x webp.py.

  3. Create a soft link to the script using sudo ln -s /path/to/downloads/webp.py /usr/bin/webp.

  4. Install the appropriate libwebp precompiled utilities from Google.

Usage and Syntax

The tool converts all valid images in a directory, and all nested subdirectories, to WebP and generates the output files for those images. Static images are converted using the cwebp CLI utility. Animated GIFs are converted using the gif2webp utility that comes with the download.

Syntax:

webp [options] path/to/images

For a list of options, please see Google's documentation for cwebp.

Example usage:

webp -q 80 ~/img/

This would convert all images under the ~/img/ directory, as well as all images in any nested subdirectories, to WebP.

Note: If you're using WSL on Windows, copy the directory from File Explorer and feed it to the built-in wslpath utility:

webp [options] "$(wslpath "/path/to/images")"