0> In article <[EMAIL PROTECTED]>,
0> Jean-Luc Coulon <URL:mailto:[EMAIL PROTECTED]> ("Jean-Luc") wrote:

Jean-Luc> A nice feature in this case would be to be able to get the
Jean-Luc> white point in an OTHER picture.
Jean-Luc> With digital photography, I use often raw pictures. At the
Jean-Luc> beginning of the shot, I get a picture of a grey/white card
Jean-Luc> which will be the white reference for all the following
Jean-Luc> pictures.  If the light conditions change, I get an other
Jean-Luc> picture of the grey chart and so I never mind of the camara
Jean-Luc> white balance, all the wotk is done in post-processing.
Jean-Luc> So it would be nice to be able to open a white reference
Jean-Luc> picture and pick reference from this picture an apply it to
Jean-Luc> the other shots.

I use a script that does this.  It's very simple and doesn't deal with
colour management, or extreme colours.  It is, however, simple to use -
just select the colour that should be white (e.g. with the picker), and
then run the plug-in.  It's particularly handy for your case, because
as long as you have the same selected foreground colour, you can run
the script on many images.  Here's the script-fu:

---- cut here ---
; whitebalance.scm

; adjust image white balance based on current foreground color.

; Author: Toby Speight <[EMAIL PROTECTED]>
; Licence terms: GNU GPL v2 or later

 "<Image>/Colors/_White Balance"
 "Adjust the image colors so that the current foreground color becomes 
completely desaturated.  In other words, if you have selected a color from the 
image that should be white, then this will correct any color cast."
 "Toby Speight <[EMAIL PROTECTED]>"
 "Toby Speight"
 SF-IMAGE    "Image"    0
 SF-DRAWABLE "Drawable" 0)

(define (script-fu-whitebalance img drawable)
  (let* ((color (car (gimp-context-get-foreground)))
         (red (car color))
         (blue (cadr color))
         (green (caddr color))
         (mean (/ (+ red blue green) 3.0)))
    ;; TODO: check for divide-by-zero
     1  img  drawable  0
     (/ mean red) 0.0           0.0
     0.0          (/ mean blue) 0.0
     0.0          0.0           (/ mean green))

Gimp-developer mailing list

Reply via email to