Created
September 24, 2014 12:55
-
-
Save jnsdbr/a0e428a948b6e268d3a8 to your computer and use it in GitHub Desktop.
Image modifiers
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 | |
find . -type f -name "*.jpg" | while read line | |
do | |
dir=${line%/*} | |
file=${line/##*/} | |
file=${file} | |
convert "${file}" -resize 400 "resized/${file}" | |
done |
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 | |
find . -type f -name "*.jpg" | while read line | |
do | |
dir=${line%/*} | |
file=${line/##*/} | |
file=${file} | |
read -r _file _file2 _width _height <<< $(convert -format "%f %w %h" "${file}" info:) | |
filename="$_file $_file2" | |
width=$_width | |
height=$_height | |
if (($width > $height)); then | |
echo "Rotated -> ${filename}" | |
mogrify -rotate 90 "${filename}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment