Automator - Crop From Specified Edge

Solution 1:

Install Homebrew and then install ImageMagick with brew install imagemagick.

for f in "$@"; do
    # mogrify when file is a png or file is a jpg image
    [[ "$f" != *.png && "$f" != *.jpg ]] && continue
    /usr/local/bin/mogrify -crop 50x50+0+0 "$f"
done
  • -crop 50x50+0+0: crop from the top left corner, create only one image
  • -crop 50x50+0+0 -gravity SouthEast: crop from the bottom right corner
  • -resize 160x90^ -gravity center -extent 160x90: make images smaller or bigger and crop them so that they fill the specified area
  • -crop '-50-50' -crop '+50+50': crop 50 pixels from all sides

See http://www.imagemagick.org/Usage/resize/ for more examples.