Batch Convert Images Between Formats with Image Magick

May 27, 2020
Est. Reading: 2 mins

Image Magick is a command line utility for converting, editing, and composing images. Image Magick can convert your JPEGs in minutes, probably even seconds.

Let’s say you have a folder full of images in a certain format. JPEG, for argument’s sake. What would you do if you suddenly needed all of those JPEGs in the PNG format? Open them all up and manually re-save each one in Photoshop? What if there were over 1,000 files? Converting each file individually could take hours. No, what you need to do is batch convert your images.

Install Image Magick

First things first, install Image Magick. If you use a Mac or PC, just grab the latest binary release for your operating system.

Dive into the command line

Image Magick is a command line utility, meaning you use it by typing commands into the Terminal, or a DOS prompt.

Mac users should start up the Terminal: press CMD+Space and type “Terminal”. If you do not have Spotlight Search, open a Finder window, click on “Applications”, pop into the “Utilities” folder, and double-click on “Terminal”.

PC users should get a DOS prompt going. Vista users can press “Start” and type “cmd” into the search box. Everyone else, follow these instructions:

  1. Click “Start”.
  2. Click “Run”.
  3. Type “cmd” (without quotes).
  4. Press the “Enter” key.

Navigate your file system

OK, you made it this far, and you are starting at a blinking cursor. Now, you must navigate to the folder in which your image files are located. You can change directories with the cd command. If they are in a folder called “img” on your Mac desktop, type cd /Users/you/Desktop/img and hit the “Return” key, where “you” is your OS X username (short name). If they are in a folder called “pics” on your C: drive, type cd c:pics and hit the “Enter” key.

If you must navigate through folders whose names contain spaces, enclose those folder names in double quotes. Example:

C: (press Enter)

cd "Documents and Settings" (press Enter)

cd myUsernameDesktop (press Enter)

Convert your files with Image Magick

Alright, the moment of truth has arrived. Your command prompt has you staring at a directory full of JPEGs that should be PNG files. Type:

mogrify -format png *.jpg

Press the Enter key, and Image Magick goes to work. In a few momemts, when a new command prompt appears, you will have PNG copies of your JPEG files.

Leave a Reply

Your email address will not be published. Required fields are marked *