Skip to content

Instantly share code, notes, and snippets.

@DSchau
Created December 30, 2022 18:51
Show Gist options
  • Save DSchau/7f5a539cd198addfbff64d4acd5eaf2a to your computer and use it in GitHub Desktop.
Save DSchau/7f5a539cd198addfbff64d4acd5eaf2a to your computer and use it in GitHub Desktop.
Optimize Images
#!/bin/bash
find . \( -name '*.JPG' -o -name '*.jpg' \) -size +10kb | while read f
do
filename="optimized/$(echo $f | sed "s/\.\///g")"
echo "$filename"
convert "$f" -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG "$filename"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment