How To Convert JPEG / JPG / PNG to WebP in Terminal on MacOS
![Oscar de la Hera Gomez](https://www.delasign.com/CDN/headshots/profile.webp)
![How To Convert JPEG / JPG / PNG to WebP in Terminal](https://www.delasign.com/CDN/images/WebP-Terminal-Hero.webp)
Open Terminal, set the directory of your image folder and run a line listed below.
Step One: Open Terminal
![Open Terminal](https://www.delasign.com/CDN/images/WebP-Terminal-Open-Terminal-Screenshot.webp)
Press command + space and search for Terminal. Press Enter.
Step Two: Set your image directory
![Set your image directory](https://www.delasign.com/CDN/images/WebP-Terminal-Set-Current-Directory-Screenshot.jpg)
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](https://www.delasign.com/CDN/images/WebP-Terminal-Run-Screenshot.webp)
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](https://www.delasign.com/CDN/images/WebP-Terminal-Convert-to-WebP-Screenshot.jpg)
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 inquiries@delasign.com with any thoughts or feedback you may have.