Created
March 6, 2015 17:03
-
-
Save cristianobecker/9ce80d3e8fc83a1d43fc to your computer and use it in GitHub Desktop.
Edit multiple images with imagemagik (resize, optimize and thumbnail)
This file contains 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
# RESIZE AND OPTIMIZE (based in height) | |
HEIGHT=500 | |
mkdir -p result | |
for f in *.jpg; do | |
convert "$f" -resize "x${HEIGHT}" -strip -quality 90% "result/$f" | |
done | |
# THUMB | |
WIDTH=200 | |
HEIGHT=225 | |
mkdir -p thumb | |
for f in *.jpg; do | |
convert "$f" -strip -quality 90% -resize "${WIDTH}x${HEIGHT}^" -gravity center -crop "${WIDTH}x${HEIGHT}+0+0" "thumb/$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment