Needing a fast, simple and free way to batch convert all your uncompressed RAW photography for a backup drive or cloud storage? Wishing you had a second card slot on your camera for on the fly JPG backups but don’t want to pay 1000s on a higher end camera with that functionality. Don’t want to waste space saving as JPG on the SD card you are saving the RAW photos to? ImageMagick has you sorted.
I’m an avid photographer, I love going out photographing the world on my Canon EOS 70D DSLR. I try to keep up to speed with backing everything up. But when you’re out photographing in RAW all the time, that soon mounts up from GBs of data to TBs of data. Try backing that up to the cloud on a slow ADSL connection. Good luck with that. Try even backing that up to the cloud on a Fiber connection. It’s just not viable, especially considering that you’ll be paying a huge sum for the cloud storage to store it all.
Canon, Nikon and a lot of high end DSLRs have dual card slots, either both being SD, or the second being a CF slot. These cameras can backup on the fly saving JPG versions of your RAW photographs on the backup card which you can then copy to your backup place without doing any RAW to JPG conversion afterwards.
I do not however have a camera that can do that. I could save both JPG and RAW on my SD cards, but you’ll have to have more SD cards/bigger capacity cards for doing that.
If you want a GUI method to batch convert, Photoshop can do that for you, but if you don’t have Photoshop and/or don’t mind using a terminal/command prompt to do the process, by using ImageMagick, you’ll be flying through converting your photos.
ImageMagick works on Linux, on macOS with MacPorts/Homebrew and Windows. Keep following for how to install and use ImageMagick to convert your photos..
For macOS, download and install Mac Ports following the instructions provided on the site. When you have installed Mac Ports, install ImageMagick using Mac Ports in the terminal:
- sudo port install ImageMagick
For Linux, if you are using a Debian based distro and have the “apt-get” package installed (installed on all Ubuntu and Ubuntu based distros), use Apt-Get in the terminal:
- sudo apt-get update && apt-get install imagemagick
If you do not have apt-get on your Debian based distro, use Aptitude instead:
- sudo aptitude update && aptitude install imagemagick
If you use a Red Hat based distro such as Fedora or CentOS, use Yum:
- sudo yum install ImageMagick
To use ImageMagic to convert your photos, it is basically the same on Windows, macOS and Linux. First, browse to your RAW images folder in the terminal/command prompt. We will call this folder RAW.
In the command prompt, use ‘cd’ to go to the directory:
- cd path\to\directory\RAW
Use a backslash before the path if you are going from the root of the drive.
If the directory is on another drive, use the /d parameter:
- cd /d D:\path\to\directory\RAW
If the path includes folder/file names with spaces, quote the path which you can either do like:
- cd /d "D:\path to directory\RAW"
- cd /d D:\"path to directory"\RAW
The Windows command prompt is not case sensitive so capitals do not matter.
To make things quick and simple, instead of writing long paths, first write the start of the command and then drag and drop the folder into the command prompt window where the path needs to go.
Linux and macOS
In the terminal use ‘cd’ to go to the directory:
- cd /path/to/directory/RAW
Note that the terminal is case sensitive and uses forward slashes, so when you write the path, be sure to check for capitals and that you are using forward slashes, not backslashes like Windows uses.
When a directory name has spaces, you need to make sure to include a backslash before the space. So if RAW is in a folder called “path to directory”, you must do the directory path in the terminal as:
- cd /path\ to\ directory/RAW
Again, to make things quick and simple, instead of writing long paths, drag and drop the folders in the terminal where the path needs to go.
So now you are in your RAW images directory. If you simply want to convert the RAW images into JPGs in the same folder, write this mogrify command replacing ‘.RAW with the file extension used by your camera (eg: CR2 on Canon, NEF on Nikon):
- mogrify -format jpg *.RAW
If you want ImageMagick to put the images in another folder, add a -path variable using the path rules as above when you were using the cd command:
- mogrify -format jpg -path \to\the\output\folder *.RAW
Linux and macOS
- mogrify -format jpg -path /to/the/output/folder *.RAW
Make sure to change the extension on Linux and macOS to lowercase if your camera uses a lowercase extension.
Again, you can just drag and drop the folder instead of writing long paths.
It will now do the batch process converting all of your RAW files to JPG files. Obviously, you can use this to convert any image formats to any other image formats. Just change the ‘jpg’ after ‘-format’ to what other extension you want to use and the extension on the end to whatever extension the images are that you want to convert.
You might notice that your new converted JPGs may have the creation date listed as when ImageMagick converted them. If this does happen, your images still have all their original data about when they created despite the operating system showing them as just created. By looking at the Exif data of your images, you will see the proper dates. This isn’t something specific to ImageMagick. If other ways of copying files keeps the dates, so will ImageMagick. If it’s the opposite, so will be ImageMagick. The only way to avoid this is to use the save as JPG alongside the RAW on your camera as you’re shooting or getting a higher end camera with dual card slots for the seperation.
Converting image file formats are not the only things you can do with ImageMagic. You can crop images, change the image resolution, change the quality, add blur to your images, even merge images together side by side etc. You can do so much things all at once in one command. You can even make ImageMagick do things automatically on PHP servers such as auto creating thumbnails in a thumbnail folder of all images in the images folder. I have yet to work this automated side out, but creating thumbnails and resizing my images for my website, I am always using ImageMagic for that.
Tips for backing up your files
I cannot preach about how good I am with backing up my files. I have written this tutorial so I can improve that myself, as well as learn doing things like using ImageMagick for this and having this for future reference if I need to refresh my brain.
The way I notice that most photographers backup their work is have a master HDD (mine is a 4TB HDD connected to my router so always accessible on my network), then have smaller capacity HDDs for archival backup purposes. One for one year, another for another year keeping them together in a box/drawer or so where it is easy access in an emergency. 1TB HDDs are cheap enough, so they are very viable ways of backing up your files getting one each year. Then have an off site backup, in this case cloud storage, what I am converting my images to JPG for. If worst comes to worst and you lose all backups local, sure it will suck having only JPGs, but it is better than nothing, especially if you’ve edited all or most of your RAW photography already.
Back in 2014, I bought a cloud storage plan meaning to upload everything so I have an offsite backup if anything was to happen to my local copies… Well something did happen. My four year old external HDD’s RAID controller (RAID0) died back in 2015. I didn’t know about RAID then. I just knew it was two HDDs acting as one. I learnt about RAID and RAID0 thanks to LinusTechTips’s video about their WHONNOCK server’s RAID failure, which was also a RAID0 config, which they uploaded basically at the same time as I had my HDD’s RAID failure. Learning of how serious a RAID0 failure is compared to other configs, I used the same recovery service Linus used, WeRecoverData. It may not of been the cheapest, but with Linus’s video about their almost total company catastrophe, I knew it was going to be a big success and that I could trust them. I have lost a few RAW pictures here and there since that, but 5 or so among 600/800 per archive, not something to cry about.
That is a situation I never want to be in again. Backing RAW images offsite, it’s a tedious process, and so is creating backup archival HDDs of your RAW images if you aren’t patient enough. That is where converting your images to JPG is a perfect solution.
I hope this helps you out saving you a tonne of money and time, and helps you ensure you keep your data safe, accessible and more organised.