Created
July 10, 2020 06:18
-
-
Save antonfisher/6a6c632fc805a6d6e7bf1fac25dea970 to your computer and use it in GitHub Desktop.
Resize all found images greater then some width
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
#!/usr/bin/env bash | |
MAX_WIDTH=800 | |
echo "Looking for images..." | |
find . -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" | | |
while read name; do | |
width=$(identify -format "%w" "$name") | |
if [ "$width" -gt "$MAX_WIDTH" ]; then | |
convert ${name} -verbose -resize $MAX_WIDTH ${name} | |
fi | |
done | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment