How to Shorten the cwebp Command in Linux Mint with a Bash Function – MCQ Academy – English
Learn how to create a simple Bash function in Linux Mint that shortens the cwebp command and converts PNG or JPG images to WebP with less typing.
I usually optimize images locally before uploading them to the live servers for my websites. Since I use Linux Mint, one of my regular tools for this job is cwebp, which I run directly from the command line to convert PNG and JPG images to WebP.
My most-used command is simple:
cwebp image-name.png -o image-name.webp
It works well, but after using it again and again, I started looking for a way to avoid typing the same filename twice every time I convert an image. When filenames are long, that small repetition becomes even more annoying. …