How to bulk process your raw photographs for quick posting

in #photography7 years ago

One of my volunteer jobs is to take pictures of various meetings and conventions for my church group. This process usually involves a few hundred photos per day, all of which need to be processed before I post online. The only problem is that I shoot in a raw format, and I can only process photos so quickly.

I use Affinity photo to edit my raw files, but it can take me an hour just to edit a few of them. I needed a faster solution. I didn't need anything fancy, just something to allow the photos to be presented in a way for displaying online. If somebody wanted to print off one of the photos, I could easily to back and reprocess the file for printing.

I use a Macbook Pro as my personal computer, which allows me to use terminal to write a script to help me process these files. I will be using homebrew to install some of the software needed.

Homebrew is super simple to install, and can be found at brew.sh or installed by typing the following into your terminal session.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

That's about it, homebrew has been installed.

Now we'll need to install the software to actually process the raw files. The first piece of software is called ImageMagick. This tool can be installed via brew install imagemagick. Because we're editing raw files, we'll also need to install dcraw the same way we installed ImageMagick. brew install dcraw. Now let's look at how to actually process these files.

I store all of my raw files in a single folder. My file structure for my photos will look like this:

|-photos/
|---- raw/
|---- process.sh
|---- processed/

The raw photos will obviously be in the raw folder. Next, create a folder called processed where our processed photos will be placed. We will now create our process.sh script to process our photos.

Open up a text editor and add the following code:

for file in raw/*
do
    filename=$(basename "$file")
    extension="${filename##*.}"
    filename="${filename%.*}"
    convert "$file" -colorspace RGB -colorspace sRGB ./processed/"$filename".jpg -thumbnail 150x150^ -gravity center -extent 150x150 ./processed/"$filename"_sm.jpg
done

Now save the file as process.sh and in your terminal, make it executable. chmod +x process.sh. The file above will loop through every photo in your raw folder, convert them to an RGB colorspace, save it as a jpg, generate a 150x150 px thumbnail, and save both of the images in the processed folder. This will continue until every photo in the raw folder has been processed.

To execute your script, in terminal simple type ./process.sh.

This process can take a while, but for me, it was definitely faster than processing every photo manually.