Got a folder full of images that need to be converted from one format to another? Use Image Magick and do in a few seconds what it could take hours in Photoshop or other image editing applications to achieve.
One of the simplest ways to convert a directory full of images from one format to another is to use the free Image Magick command line utility.
Image Magick, available for a large variety of operating systems, including both Windows or Mac, also does a whole lot more besides, but for this post, I’m just going to mention one particular feature, converting between image file formats.
You can download Image Magick, which is free, for your operating system, from this link.
Assuming you’ve already installed Image Magick, your next step is to get to the command prompt (Windows) or a Terminal (Mac).
Once you’re at the command line, and assuming you let Image Magick install correctly, you should navigate to the folder that contains the images you want to convert.
The command to convert from one format to the other is really simple. Assuming you have a whole bunch of PNGs and you want to convert them in to JPGs, you simply use:
mogrify –format jpg *.png
The mogrify
command is what will convert the images, the first parameter “-format jpg”
tells mogrify
to convert to JPG format, and the second parameter “*.png”
means that it only works on the PNG images in the directory. If you have a mix of image types, say GIF and PNG, in this particular instance the GIFs will be ignored, and only the PNGs will be converted.
Once the command is complete, the images are magically converted. It all happens so fast you probably won’t have time to even step away from the keyboard before it is done unless you have a directory of thousands upon thousands of images.
Image Magick supports dozens of input and output formats, and can do a whole lot more than just convert formats so you should certainly check it out.
I make use of Image Magick in so many different projects of my own, including my personal SenseCam project for J2ME and iPhone for manipulating the images after transferring them from the Sensecam mobile application to the desktop for cataloguing, that without this amazing software I’d have to write my own less than stellar solutions.