#!/bin/bash #crops all images to a square #set output size size="300" for i in ../imgs/*; do #get longest side s="$(identify -format "%[fx:min(w,h)]x%[fx:min(w,h)]+0+0" $i)" convert $i -gravity center -crop $s -resize $size "$(basename $i)" done