Get more informations at https://developers.google.com/speed/webp/docs/precompiled
brew install webp
Use wget
:
wget -O /usr/local/bin/convert-to-webp https://raw.githubusercontent.com/mheob/convert-to-webp/main/convert-to-webp && \
chmod +x /usr/local/bin/convert-to-webp
Or use curl
:
curl -o /usr/local/bin/convert-to-webp https://raw.githubusercontent.com/mheob/convert-to-webp/main/convert-to-webp && \
chmod +x /usr/local/bin/convert-to-webp
The files where always stored in the directory you are in!
You can check your current working directory with the pwd
command.
# The easiest one
convert-to-webp
# Show the help
convert-to-webp -h
convert-to-webp --help
# Specify the quality (default 70)
convert-to-webp -q 60
convert-to-webp --quality 80
# Specify the destination folder directly
convert-to-webp . # for current folder
convert-to-webp ./images # for the subfolder "images"
convert-to-webp ../images # for the folder "images" in the current neighbor directory
convert-to-webp ~/Downloads # for the "Downloads" folder in your "HOME" directory
# Combine the quality and the destination
convert-to-webp -q 50 ~/Downloads # converts from "~/Downloads" with the quality of 50%
In your .bash_aliases
or .zshrc
add for example
alias ctw="convert-to-webp"
Of course you can choose what ever you want.