I resize images fairly frequently, usually for blog posts and emails. These two automations help me resize a group of images in bulk, without needing to load them into The GIMP. Most of my image manipulation automations take advantage of ImageMagick, which is an excellent set of cross-platform command-line tools for scriptable image manipulation.

These automator workflows are also available on GitHub.

Ask for resized image size

This standalone automation uses a pop-up dialogue to ask for a number, which is used as the large-side target dimension of the resized image. This is useful because we can call it from a command-line script and use it to populate a variable for the script to use.

Set up an Automator Service that has a single step; "Ask for Text". Set a sensible question (such as "How large should the largest side of the resized image be? (measured in pixels)") and default answer, and then you're good to go.

Make smaller copy

First, install ImageMagick command line tools via brew:

brew install imagemagick

Then set up an Automator Service that receives "image files" in "Finder.app". Use the shell "/bin/bash" and pass input "as arguments". Use the following code:

size=`automator ~/Library/Services/Ask\ for\ resized\ image\ size.workflow`
if [ ! $size ]; then
    exit 1
fi
for f in "$@"
do
    /usr/local/bin/convert "$f" -resize ${size}x${size} -quality 85 "${f%.*}-${size}.${f##*.}"
done

Notice that this script calls the "Ask for resized image size" workflow to get the size value. ImageMagick's "convert" program will try to resize the image using "size" as the length of the longest edge, keeping the same aspect ratio.