Created
October 25, 2017 12:51
-
-
Save matthiassturm/30651d7c1be2b2e260c89c7071bc284c to your computer and use it in GitHub Desktop.
Resize to square and compress
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
#!/bin/bash | |
# before running this script, do: | |
# brew install imagemagick jpegoptim | |
mkdir output | |
for f in *.jpg; do | |
convert -resize '300x300^' -gravity center -crop 300x300+0+0 ./"$f" ./output/"$f" | |
done | |
# optional: compress all images | |
jpegoptim -s ./output/* | |
du -sh ./output/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment