How can I batch-correct white balance across many JPEGs shot under changing light?

Asked 5/14/2015

4 views

2 answers

0

I have a large set of JPEG images of the same subject taken over several hours, so the color balance varies as the light changed. I want the images to end up with a more uniform white balance across the batch, while keeping each photo’s own exposure/brightness.

I’ve tried ImageMagick scripts and darktable, but the scripts were either too crude or too slow, and darktable just copied the same white-balance adjustment from one image to every file instead of recalculating per image.

Is there a practical way to batch-adjust JPEGs so each image gets its own automatic color correction, rather than applying one identical white-balance setting to all of them?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

9

If you find that hitting the "auto" button in the GIMP levels dialog generally does the thing you're looking for, you can batch that as described here.

Specifically, you would put this script:

(define (batch-auto-levels pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
  (while (not (null? filelist))
         (let* ((filename (car filelist))
                (image (car (gimp-file-load RUN-NONINTERACTIVE
                                            filename filename)))
                (drawable (car (gimp-image-get-active-layer image))))
           (gimp-levels-stretch drawable)
           (gimp-file-save RUN-NONINTERACTIVE
                           image drawable filename filename)
           (gimp-image-delete image))
         (set! filelist (cdr filelist)))))

into the GIMP scripts directory (~/.gimp-x.x/scripts/ or %appdata%\GIMP\x.x\scripts on Windows) named 'batch-auto-levels.scm' and then run

gimp -ifd -b '(batch-auto-levels "*.jpg")' -b '(gimp-quit 0)'

within the directory containing the images. Note that this will overwrite the images - copy them to a test directory and work on that until you know the results are what you want. Also make sure that your metadata is intact (GIMP is pretty good about this these days). You can set the JPEG quality you want to use as the default in the GIMP JPEG export dialog, then quit GIMP before running the batch script.

Originally by user37649. Source · Licensed CC BY-SA 4.0

user37649

11y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

A practical batch option mentioned in the answers is to use GIMP’s automatic levels/stretch correction on each file individually.

Instead of copying one white-balance setting to every image, this recalculates the correction per image, which is closer to what you want when lighting changed over time. Two ways suggested:

  • Use a GIMP batch script that runs gimp-levels-stretch on all matching files.
  • Use the BIMP plugin for GIMP and apply gimp-level-stretch to the whole folder.

One user reported it worked well on about 200 images, with only a small number needing manual rework.

Keep in mind that with JPEGs, white balance correction is more limited than with RAW, so results may not be perfect on every shot. For future sessions, shooting RAW gives you much more flexibility for matching color across a set.

UniqueBot

AI

11y ago

Your Answer