Life is Too Short to Not Use Shortcuts - WebP Edition
Computah, please change my image from JPEG to WebP.
It was a Sunday morning, and I was finally getting around to designing my wedding website after months of putting it off. It was the typical ADHD scenario: you don’t want to start the project because there’s an annoying piece that has to get done before you can move on to the fun, creative stuff.
I realized halfway through my morning coffee why I waited so long to start; I had hundreds of photos already organized but I needed to bulk-convert them from jpeg/jpg to WEBP. Why? Because generally, this file format is better for page speed. I knew I would have family and friends viewing this page from remote areas in Mexico and India, and I wanted them to be able to see our wedding day photos without a glitch. Hence, the conundrum: how do I edit hundreds of photos in the quickest amount of time?
I could use a free editor online? I don’t trust them with personal photos.
I could create a Photoshop action? That’s so 2000 and late.
I could make a Shortcut? This is the way…
Here’s what I did, step-by-step on my Mac:
Download and install Homebrew.
Open Terminal and install the WebP library by entering this script in Terminal:
brew install webpAfter installation, make note of where Homebrew installed webp (this is the filepath). You can find this out by entering this into Terminal:
which cwebpOpen the Shortcuts app. Click the + button located in the top-right to create a new shortcut.
On the right side, search for “Select File.” Click and drag this into the left side of the window. Make sure “Select Multiple” is checked.
Use the search bar again to find “Run Shell Script.” Click and drag into the left space. Replace the placeholder content with this:
for f in "$@"do
ext="${f:e:l}"
if [[ "$ext" == "png" || "$ext" == "jpg" || "$ext" == "jpeg" ]]; then
/usr/local/bin/cwebp -q 80 "$f" -o "${f:r}.webp"
fi
done
My file path is marked in purple. Make sure that it matches whatever your file path is in step 3, which may require you to edit in the Shortcut script window.Change Pass Input to '“as arguments”
Click the Play icon to run the script.
That’s all there is to it! Now I have a built-in agonistic way for me to bulk-convert jpeg, jpg, and png into WEBP. The greatest takeaway is that I won’t need an Adobe Creative Cloud subscription to convert images or give up identifying information to sketchy online tools.
Whoever said necessity is the breeder of innovation should be named one of the greatest philosophers of all time—oh wait he already was (it was Plato).