I'm trying to create an Automator folder action to automatically crop images that are added to a specific folder. It works; however, it crops the images towards the center. How can I crop starting from the right edge? I found Propper Cropper, which looks like it does what I need, but unfortunately it was compiled for PPC, and is therefore not a universal action. Is there an alternative (preferably an Automator action)? If this is not possible with Automator, is there some other software I can download to achieve this?
1 Answer
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.