Convert images to JPEG on Finder

The format of photos taken by iPhone is “.heic” (High Efficiency Image File Format (Wikipedia)). It’s fine as long as I see them on Mac. But sometimes I need to covert it to JPEG (for blogging .etc)

How to convert it easily?

We can enhance Finder Quick Actions with Automator which is pre-installed on macOS.

You can download this workflow from my GitHub repo(ecpplus/shell-utils)

Convert it on command line

sips

By default, macOS has image processing cli named sips. It is located at /usr/bin/sips. There are bunch of options, but for now I only use format conversion.

Converting any image to jpeg command is below;

sips -s format jpeg $input_path --out $output_path

format output path

Output path should be foobar.jpg. On shellscript, we can easily format it from original path.

INPUT="/foo/bar/IMG_1234.heic"
echo ${INPUT%%.*}.jpg

=> /foo/bar/IMG_1234.jpg

support multiple images input

Now, I’d like to convert multiple images at once. We can use for loop like this;

for f in "$@"
do
  sips -s format jpeg "$f" --out "${f%%.*}".jpg
done

Make Automator workflow

  1. Launch Automator.app in Applications.

  2. Create a new workflow from File (⌘N)

  3. Choose Quick Action New workflow

  4. Define work flow as shown below Workflow definition

    1. Find Run Shell Script from actions.
    2. Workflow receives current image files in Finder.app
    3. Type shell script.
    for f in "$@"
    do
      sips -s format jpeg "$f" --out "${f%%.*}".jpg
    done
    
  5. Then save and name this workflow.

  6. That’s it. You can now use it on Finder.

How to use it

From context menu

  1. Choose single or multiple files on Finder, then right click.
  2. Choose Service > Convert to JPEG (depends on your workflow’s name)

From context menu

From preview area

  • On my Mac, it’s automatically shown on my preview area. It’s easier.

From preview area

Contents