Advertisement
ebrobertson

Convert JPG to WEBP

Aug 7th, 2023
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 0.50 KB | Software | 0 0
  1. # get's all the .jpg files in the directory and converts them to webp
  2. # must have downloaded google's webp lib from: https://developers.google.com/speed/webp/docs/precompiled
  3. # then just have this script and your jpgs in the same folder as the cwebp.exe file and run it.
  4. $files = Get-ChildItem "C:\tools\convert to webp" -Filter *.jpg
  5. foreach ($f in $files){
  6.     echo $f.BaseName
  7.     $jpg = $f.BaseName + '.jpg'
  8.     $webp = $f.BaseName + '.webp'
  9.     echo $jpg
  10.     .\cwebp.exe -q 80 $jpg -o $webp
  11. }
Tags: Utilities
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement