/Image-to-Webp-Converter-Tool

A simple conversion script for all images in a directory to be converted to the webp format using cwebp

Primary LanguagePythonMIT LicenseMIT


Logo

Image to Webp Conversion Helper Tool

A simple tool written in Python for converting a directory of images into the webp format using Google's WebP Converter.

Getting Started

In order to use this tool, you will need to have Google's WebP Converter installed.

Without it, python will be unable to call the cwebp command from the CLI and convert applicable images.

Usage

Convert

The convert command will walk through a specified directory and convert all applicable images to webp at the quality level specified.

# convert all applicable images 
# in the supplied images directory
#
# python main.py convert [directory] [image quality]
python main.py convert "./images/" 75

The directory can be the images folder or it can be any directory locally accessible.

# convert all applicable images 
# in a system directory with a lower quality set
#
python main.py convert "C://Users/bob/web_images/" 50

Cleanup

Once images have been converted, they are added to a CSV file in the results directory (/results/converted_image_list.csv').

The CSV file is overwritten every time the convert command is run.

The cleanup command will look through the converted_image_list.csv and delete the original images and keep the webp ones.

# delete all the original images and keep the webp ones
#
python main.py cleanup

License

Distributed under the MIT License. See LICENSE.txt for more information.

References & Resources