Skip to content

Instantly share code, notes, and snippets.

@2803media
Last active September 23, 2024 19:12
Show Gist options
  • Save 2803media/a3b0d4a4b53fa6b0db314df5d321b3dd to your computer and use it in GitHub Desktop.
Save 2803media/a3b0d4a4b53fa6b0db314df5d321b3dd to your computer and use it in GitHub Desktop.
convert webp
#une image
cwebp -q 80 road.jpg -o road.webp
#toutes les images d'un dossier
find . \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 -n 1 -P 0 -I '{}' cwebp -short -q 80 '{}' -o '{}'.webp
#resize d'une image
sips -Z 1280 road.jpg
#resize de toutes les images d'un dossier
sips -Z 1280 *.jpg
#schema.org image
find . \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 -n 1 -P 0 -I '{}' sh -c '
input="{}"
output="${input%.jpg}.webp"
convert "$input" -resize 1200x628^ -gravity center -extent 1200x628 "$output"
cwebp -short -q 80 "$output" -o "$output"
'
#max 1080
find . \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 -n 1 -P 0 -I '{}' sh -c '
input="{}"
output="${input%.jpg}.webp"
convert "$input" -resize 1080x1080^ "$output"
cwebp -short -q 80 "$output" -o "$output"
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment