8
\$\begingroup\$

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?

\$\endgroup\$
13
  • \$\begingroup\$ Is ufraw-batch with --wb=auto an option? \$\endgroup\$
    – sebix
    Commented May 14, 2015 at 13:24
  • 1
    \$\begingroup\$ @wiso Yes, this is a known issue in darktable. There's been discussion on the mailing list about how to implement the behavior you want, though, so it will probably exist eventually. \$\endgroup\$ Commented May 14, 2015 at 20:30
  • 1
    \$\begingroup\$ I thought this was fixed in Darktable 1.4? You can create a module preset that will be applied with auto as a default. You can then have this preset applied when you open an image, I'm not sure how you can have it applied as a batch though. \$\endgroup\$ Commented May 14, 2015 at 21:45
  • 1
    \$\begingroup\$ @JamieKitson This works for lens correction, and possibly exposure and other modules with an "auto" checkbox (I haven't tried), but with white balance it needs to select "spot white balance" from a list... if there's a way to auto-apply this on import, please do supply it as an answer - I'm not aware of one. \$\endgroup\$ Commented May 14, 2015 at 22:03
  • 1
    \$\begingroup\$ @junkyardsparkle Looks like you're right. I think I was testing it on similarly shot photos and just assumed it was working. \$\endgroup\$ Commented May 18, 2015 at 9:17

2 Answers 2

9
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ The link in this answer is broken. \$\endgroup\$
    – larsks
    Commented May 25, 2018 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.