Applying batch color corrections to images

There are surprisingly few tools for applying identical color corrections to multiple images. Existing tools focus on applying an identical color curve to all images. But these don't work well when doing more complex corrections, such as selectively adjusting hue or saturation, or using multiple layers.

So I have made this 50-line hack to do it.

The tool first creates a 4K reference image, which contains the original images, plus a color ramp. You color correct this image, then the tool makes the same correction to all the originals.

To run it, gather some images (all should be the same size) and do:

$ multigrader.py images/*.jpg
Making template grade.png
1/4 images/DSC_4758.jpg
2/4 images/DSC_4795.jpg
3/4 images/DSC_4815.jpg
4/4 images/DSC_4817.jpg
Now edit grade.png then re-run multigrader.py

This creates grade.png. You can then color correct this image, using GIMP or Photoshop using the guide images at the top.

Any color-only operation is permitted, including select pixels by color. However you cannot make any per-pixel changes to this image, for example painting and blurring are not allowed.

Then re-run multigrader, and it will apply the change in grade.png to the originals:

$ multigrader.py images/*.jpg
Applying grade.png to all images
1/4 images/DSC_4758.jpg
2/4 images/DSC_4795.jpg
3/4 images/DSC_4815.jpg
4/4 images/DSC_4817.jpg

Implementation notes

The color ramp at the bottom of the reference image contains every possible 8-bit color. This is 16M pixels, so it fits in a 4K x 4K box. The originals are all resized to 1K wide, so four fit on each row at the top of the image.

The tool actually only loads the color ramp -- the previews at the top aren't used at all. Because the ramp contains all 16,777,216 24-bit colors, the actual transformation is a simple table lookup.

Note that the tool can apply the same transformation to any images -- not necessarily the same ones provided in the first step. So for very large batches (e.g. hundreds of images) you might choose a subset of images for the "preview". For example:

$ multigrader.py examples/*.jpg
...
$ multigrader.py allimages/*.jpg
...

The tool is at https://github.com/jamesbowman/multigrader