A simple tool written in Python for converting a directory of images into the webp format using Google's WebP Converter.
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.
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
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
Distributed under the MIT License. See LICENSE.txt
for more information.