Created
September 29, 2025 06:46
-
-
Save thetwopct/84d2f153414e26e4be35a9197bc97d09 to your computer and use it in GitHub Desktop.
Convert images in recursive directories to webp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find . -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -print0 | | |
| xargs -0 -n1 -P"$(sysctl -n hw.ncpu)" -I{} \ | |
| sh -c 'f="$1"; out="${f%.*}.webp"; [ -f "$out" ] || cwebp -quiet -q 90 -metadata icc,exif,xmp "$f" -o "$out"' _ {} | |
| # change names if you want to add, ignore, skip some file names | |
| # change 90 to 82 or another number if you want the images more lossy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment