Skip to content

Instantly share code, notes, and snippets.

@sstorholm
Forked from frozenex/bulk-convert.ps1
Last active March 1, 2022 23:12
Show Gist options
  • Select an option

  • Save sstorholm/ac6e43eea86b7c652a0a89424e3e581a to your computer and use it in GitHub Desktop.

Select an option

Save sstorholm/ac6e43eea86b7c652a0a89424e3e581a to your computer and use it in GitHub Desktop.
Bulk convert images to webp format using cwebp library in windows
# Copy this file to any directory containing images & then run this script in powershell
# Get all png images in the current directory & convert it to webp format
$images = Get-ChildItem -Path (Get-Location) -Filter *.png
foreach ($image in $images) {
$fileName = $image.DirectoryName + "\" + $image.BaseName + ".webp"
.\cwebp.exe -q 80 $image.FullName -o $fileName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment