Linux and Mac OS:
find . -iname '*.png' -exec optipng -o7 -strip all "{}" \; find . -iregex '.*\.\(jpg\|jpeg\|jpe\|jif|jfif|jfi\)$' -exec jpegoptim --all-progressive --strip-all --strip-com --strip-exif --strip-iptc --strip-icc "{}" \;
Linux and Mac OS:
find . -iname '*.png' -exec optipng -o7 -strip all "{}" \; find . -iregex '.*\.\(jpg\|jpeg\|jpe\|jif|jfif|jfi\)$' -exec jpegoptim --all-progressive --strip-all --strip-com --strip-exif --strip-iptc --strip-icc "{}" \;
#!/bin/bash I=0 for f in *.jpg do (( I++ )) r=$(printf "%03d" $I) read w h <<< $(convert "$f" -ping -format "%w %h" info: ) if [ $w -gt $h ]; then echo "$f is $h tall and $w wide (landscape)" convert "$f[800x>]" $r.jpg else echo "$f is $h tall and $w wide (portrait)" convert "$f[395x>]" $r.jpg fi done