Skip to content

Instantly share code, notes, and snippets.

@ikait
Created May 20, 2015 05:33
Show Gist options
  • Save ikait/075d8cdbda2bd4bc741d to your computer and use it in GitHub Desktop.
Save ikait/075d8cdbda2bd4bc741d to your computer and use it in GitHub Desktop.
cwebp を使ってディレクトリ内の画像ファイルを webp に変換する。クオリティ (-1) は 10 から 5 刻みで 60 まで。
#!/usr/local/bin/bash
for i in {10..60..5}
do
echo "---------------------------------------------"
echo "[start] rate: $i %"
echo "---------------------------------------------"
find . -name "*.png" -print0 | xargs -0 -I{} cwebp -q $i {} -o {}-$i.webp
echo "---------------------------------------------"
echo "[finish] rate: $i % "
echo "---------------------------------------------"
done
@ikait
Copy link
Author

ikait commented May 20, 2015

予め -q を決めておくとき:

find . -name "*.png" -print0 | xargs -0 -I{} cwebp -q 95 {} -o {}.webp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment