Skip to content

Instantly share code, notes, and snippets.

@innermond
Last active March 27, 2016 21:45
Show Gist options
  • Select an option

  • Save innermond/0fb526cc30cea81bbc10 to your computer and use it in GitHub Desktop.

Select an option

Save innermond/0fb526cc30cea81bbc10 to your computer and use it in GitHub Desktop.
rotate a portrait jpg file to a landscape, resize it and cropp it
for f in *.jpg; do wh=$(convert "$f" -ping -format '%w %h' info:); w="${wh%\ *}"; h="${wh#*\ }";[[ h -gt w ]] && echo portrait && mogrify -rotate -90 "$f" || echo landscape; mogrify -resize 220x -gravity center -crop 220x122 done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment