; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; Crudely attempt to recover photos that have been shot in low light
; doing the following:
; Duplicating the layer.
; Adding a layermask initialized to a grayscale copy to the duplicate
; Performing Auto Equalize the layermask
; Performing Auto Equalize the layer
(define (script-fu-sg-recover-candlelit image drawable)
(gimp-image-undo-group-start image)
(let* ((layer (car (gimp-layer-copy drawable FALSE)))
(mask 0) )
(gimp-image-add-layer image layer -1)
(set! mask (car (gimp-layer-create-mask layer ADD-COPY-MASK)))
(gimp-layer-add-mask layer mask)
(gimp-equalize mask FALSE)
(gimp-equalize layer FALSE)
(gimp-image-merge-down image layer EXPAND-AS-NECESSARY)
)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
)
(script-fu-register "script-fu-sg-recover-candlelit"
"Recover Candlelit Shot"
"Process layer in attempt to recover colors"
"Saul Goode"
"Saul Goode"
"Oct 2011"
"RGB*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
(script-fu-menu-register "script-fu-sg-recover-candlelit"
"<Image>/Filters/Misc"
)