TransWikia.com

How can I get a uniform white balance on a batch of JPEG images?

Photography Asked by Ruggero Turra on March 6, 2021

I have shot many photos of the same subject in JPG. Since I have shot for many hours with different light conditions the white balance is quite different for all the shots.

I would like to automatically adjust the white balance to have an uniform white balance across all the shots (while I want the luminosity to be the one of the shot).

I have tried some tools:

  • Scripts based on ImageMagick here, but they are quite primitive: one just computes the transformation so that the selected pixel is (0,0,0), so without preserving luminosity, the others are too slow

  • darktable: with this I can create a set of transformations on a picture (say, the first) and then apply it to all the others. The problem is that for the white balance it computes the transformation for the first image and then applies exactly the same transformation to the others, without recomputing the transformation for every image.

Suggestions?

2 Answers

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%GIMPx.xscripts 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.

Answered by junkyardsparkle on March 6, 2021

you can use Bimp > gimp-level-stretch. It works. I used it on 200 images and only had to re-work 10. That's cool.

Answered by ochuko on March 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP