How to Batch Convert Images to WebP on Mac

Feb 8, 2024 - 1 Comment

How to batch convert images to WebP on the Mac from Finder

As WebP grows in popularity as a compressed image format for the web, many web workers need to convert batches of images to WebP format from their Mac. Bulk converting images like JPG and PNG to WebP is not currently a native feature, but with a little tinkering on the Mac, you can gain functionality to easily batch convert any images to WebP on the Mac.

This article is expanding on this post about converting images to webp using the Mac command line. We’ll be using the same webp toolkit from Google that is installed through HomeBrew, so you’ll want to install HomeBrew first, then install the webp tools from Google via Homebrew so that you have cwebp available as a command line utility on your Mac. But you won’t need to use the command line beyond the initial installation, because we’ll be using Automator to create a Finder Quick Action that performs the image compression and conversions to webp.

How to Batch Convert Images to WebP on Mac with a Quick Action

We’re going to create a Quick Action with Automator that uses the command line cwebp tool to convert image files to webp format. The result is you will have an contextual menu option to ‘Convert to WebP’ in the Finder, that you can use with any image file or collection of image files on the Mac.

  1. Install HomeBrew and cwebp if you have not done so already (directions to install Homebrew are here, and to install cwebp are here)
  2. Open Automator on the Mac
  3. Create a new “Quick Action”
  4. Create a New Quick Action in Automator

  5. At the top of the Workflow, where it says “Workflow receives current” choose “image files”, and under “in” select “Finder”
  6. Configure the Quick Action workflow for webp step 1

  7. Next, look at the left side panel of Automator and choose “Utilities” under Library, then drag and drop “Run Shell Script” to the right workflow panel
  8. For ‘Run Shell Script’, look for ‘Pass input’ and select “as arguments”
  9. Now enter the following code snippet exactly*:
  10. for FILE in "$@"
    /opt/homebrew/bin/cwebp -q 85 "$FILE" -o "${FILE%.*}.webp"

    Your Quick Action workflow should now look like this:
    Configure the shell script for webp conversion in Automator on Mac

  11. Save your Quick Action from File > Save, name it something like “Convert to WebP” (whatever you name the Quick Action is what will appear in the Finder contextual menu)
  12. Go to the Finder on the Mac, and locate any image file or collection of image files, right-click, and select “Convert to WebP”
  13. Batch convert images to WebP files in the Mac Finder

The converted webp files will appear in the same directory with the same file names except carrying the webp extension.

With your newly created Convert to WebP Quick Action workflow, you can convert a single image file to WebP, or if you select multiple image files you can batch convert them all to WebP files.

Convert a single image to webp from the Finder Quick Action on Mac

* Some notes about this little script that you may want to change for your particular needs:

  • The path to cwebp is set for cwebp installed through Homebrew, if you installed cwebp manually then it’s probably in /usr/bin instead and you’d want to adjust the path accordingly
  • The -q quality flag is currently set to 85 but you can set it to anything between 1-100 (higher will produce higher quality images, but less compression)

Again, you can use this for a single webp file conversion, or a batch conversion of many image files, to webp format.

Batch Convert Images to WebP on Mac from a Finder Quick Action

With how popular webp is becoming, and given that MacOS currently offers native capabilities to convert WebP to JPG and open WebP image files and save the as JPEG through Preview (and batch converting webp to jpeg through that!), it seems reasonable to expect that a future version of MacOS will support the opposite direction as well; saving to WebP, and direct conversion to WebP. If and when that does occur, this particular Quick Action will no longer be needed, nor will the manual installation of cwebp from HomeBrew, but for the time being this is necessary.

For the unfamiliar, WebP is an image file format created by Google that is intended to be efficient and broadly capable, supporting still images and animations, and both lossy and lossless. The cwebp tool we use here for our purposes of batch converting images to webp is the official WebP encoder from Google, which you can read more about here if interested. The shell script we use to perform the backend conversion and compression is a modified version of what was created by Jay Holtslander from here. And finally, Homebrew is a very popular command line package manager for Mac that easily allows Mac users to install thousands of command line tools and utilities, including cwebp which we use here, without having to compile them yourself.

If you have another preferred method of batch converting image files to webp on the Mac, or an alternate approach, then share it with us in the comments below!


Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

One Comment

» Comments RSS Feed

  1. Bogdan says:

    XnConvert is free in the App Store or on the website and can convert to and from WebP

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site