ImageMagick is an incredibly powerful toolbox for working with image files. It’s a command-line tool, so you interact with it through Terminal.
Unlike SIPs, which is similar but also much more trimmed down, ImageMagick doesn’t come built-in to Mac. So you’ll first need to install it. The good news, though, is that it’s free and open-source, and the Homebrew package manager makes installing it a breeze.
The simplest way to set up ImageMagick on a Mac is through Homebrew, which is a package manager for macOS that simplifies the installation of software.
So it’s a 2-step process:
- Install Homebrew
- Install ImageMagick
So here’s a step-by-step guide to installing Homebrew and using it to install ImageMagick. And while it might look intimidating at first, it really is quite easy with just a few command lines.
How to actually use ImageMagick to perform common photography tasks is something I’ll tackle separately. There’s so much you can do with it, that it makes sense to tackle that in separate bites.
Table of Contents
Step 1: Install Homebrew
Homebrew is a package manager, which basically means that it takes care of downloading and compiling software packages. As they describe it: “Homebrew installs the stuff you need that Apple didn’t.” It’s free and very widely used and respected. You can find the project’s homepage here.
If you don’t already have Homebrew installed, open Terminal and run the following command. This command downloads and runs the Homebrew installation script.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Yes, you can copy and paste this in; you don’t have to retype it, as you would with some consoles. Make sure to include the quotation mark at the end.
Follow the on-screen instructions to complete the installation. It’s pretty descriptive about what it’s doing.
It will probably first ask you for
sudo access. That’s console-speak for your administrator password to prove you have the credentials to run the necessary scripts.
Homebrew will download and install ImageMagick and all its dependencies. You’ll see a bunch of stuff going on in the Terminal window. That’s normal. Stuff like this:
When it’s finished, you’ll see something along these lines, which includes the message that the installation was successful.
Step 2: Install ImageMagick with Homebrew
Once Homebrew is installed, you can install ImageMagick by running the following command in the Terminal:
brew install imagemagick
Once again, you’ll see a bunch of verbose descriptions of what it’s doing. Just let it do its thing.
Until you get a fresh new prompt and the message that it has completed its cleanup.
Step 3: Verify the Installation
After the installation is complete, you can verify that ImageMagick is installed correctly by running:
This command should return the version of ImageMagick that was installed, indicating that the installation was successful.
Getting Started with ImageMagick
I’m going to tackle separately some common photography-related tasks that ImageMagick is especially good at dealing with. But if you just want to try out some simple image tasks to get a feel for its syntax, here are some basic examples.
To Convert an Image from One Format to Another
For example, to convert an image from one format to another, you could use:
magick input.png output.jpg
output.jpg with the actual name of the input file and your desired output filename. It gets the format information from the file extensions (this is the most basic conversion; you can get much more control over compression etc with more sophisticated commands, but I’ll deal with those separately).
To Resize an Image
magick input.jpg -resize 1024x768 output.jpg
-resize switch in combination with widthxheight (eg.
To Add a Border
For more complex tasks like adding borders, you might use a command like:
magick input.jpg -bordercolor White -border 10x10 output.jpg
How to Update ImageMagick
A best practice for updating ImageMagick is to first ensure you’re running the latest version of Homebrew. This will refresh its list of available versions and make sure it then fetches the latest version of ImageMagick.
Once you’ve done that, you can run this to get the latest version of ImageMagick:
brew upgrade imagemagick
You can then check the version of ImageMagick installed with this command:
What is ImageMagick?
ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files. It can read and write over 200 image file formats. ImageMagick is known for its flexibility and capability to perform complex image manipulations with simple command-line syntax.
It was originally developed by John Cristy in 1987 when he was working at DuPont, and since then, it has undergone continuous improvements and updates by a community of contributors. ImageMagick is cross-platform, available for Windows, macOS, and Unix-like operating systems, and it is widely used for automated batch processing of images, creating thumbnails, image compositing, and more.
Photographers, web developers, and IT professionals commonly use ImageMagick due to its powerful processing capabilities which can handle tasks such as resizing, cropping, converting formats, and applying various effects. It is also frequently used as a component in web applications to automatically process images.
Useful ImageMagick Tasks for Photographers
I’ve put together some separate guides with ImageMagick recipes for particular tasks that I’ve found useful in a photography workflow.
- How to Convert to AVIF with ImageMagick
- How to Convert to WebP with ImageMagick
- How to Strip all Metadata from Images using ImageMagick
- How to Add a Plain Border to Images using ImageMagick
- How to Create a Contact Sheet with ImageMagick
Stay tuned: I’ll add them here as I create new ones.