How To Convert JPEG / JPG / PNG to WebP in Terminal on MacOS

Oscar de la Hera Gomez
How To Convert JPEG / JPG / PNG to WebP in Terminal

Open Terminal, set the directory of your image folder and run a line listed below.

Step One: Open Terminal

Open Terminal

Press command + space and search for Terminal. Press Enter.

Step Two: Set your image directory

Set your image directory

This can be achieved by dragging a folder into a terminal. Press Enter when ready.

Step Three: Update this line of Code

Paste Directory into line below

Paste your image directory address in place of YOUR_DIRECTORY the line below. Copy when done.

for file in YOUR_DIRECTORY*; do cwebp -q 100 "$file" -o "${file%.*}.webp"; done

Step Four: Run the line in Terminal

Sample Terminal on Complete

Terminal should look similar to the image above when complete.

Any Questions ?

We are actively looking for feedback on how to improve this resource. Please send us a note to with any thoughts or feedback you may have.

delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details