Skip to content

Instantly share code, notes, and snippets.

@npyoung
Created September 12, 2016 21:56
Show Gist options
  • Save npyoung/011c3611ca045d44a332719960759553 to your computer and use it in GitHub Desktop.
Save npyoung/011c3611ca045d44a332719960759553 to your computer and use it in GitHub Desktop.
Resize an image by scaling it down until it matches one dimension, then cropping the other dimension to center.
fname=$1
dims="180x120"
convert "$fname" -resize "$dims^" -gravity center -crop "$dims+0+0" +repage "$fname"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment