; man.scm version 1.2.11 ; 06 July 2006 ; A Script-Fu script to compensate for underwater colour loss ; at greater than 5m ; 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. ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Only tested on v2.2.11 (define (script-fu-man img photo) (gimp-undo-push-group-start img) ; first copy of photo for eventual merge (set! uw-layer (car (gimp-layer-copy photo 1))) (gimp-image-add-layer img uw-layer -1) (gimp-layer-set-name uw-layer "red enhance 1") ; second copy of photo, set foreground to grey, fill with grey, leave mode at normal (set! uw1-layer (car (gimp-layer-copy photo 1))) (gimp-image-add-layer img uw1-layer -1) (gimp-layer-set-name uw1-layer "red enhance 1a") (gimp-context-set-foreground '(128 128 128)) (gimp-edit-fill uw1-layer 0) ; third copy of photo, fill with grey and set mode to value (set! uw2-layer (car (gimp-layer-copy photo 1))) (gimp-image-add-layer img uw2-layer -1) (gimp-layer-set-name uw2-layer "red enhance 1b") (gimp-edit-fill uw2-layer 0) (gimp-layer-set-mode uw2-layer VALUE) ; merge down value to grey (clip-to-image) (set! uw-layer1 (car (gimp-image-merge-down img uw2-layer 1))) ; fourth copy of photo, set foreground to grey, fill with grey, leave mode at normal (set! uw3-layer (car (gimp-layer-copy photo 1))) (gimp-image-add-layer img uw3-layer -1) (gimp-layer-set-name uw3-layer "red enhance 1c") (gimp-context-set-foreground '(128 128 128)) (gimp-edit-fill uw3-layer 0) ; fifth copy of photo, fill with grey and set mode to value (set! uw4-layer (car (gimp-layer-copy photo 1))) (gimp-image-add-layer img uw4-layer -1) (gimp-layer-set-name uw4-layer "red enhance 1d") (gimp-edit-fill uw4-layer 0) (gimp-layer-set-mode uw4-layer VALUE) ; merge down value to grey (clip-to-image) (set! uw3-layer (car (gimp-image-merge-down img uw4-layer 1))) ; set background to red fill uw3, set mode to multiply (gimp-context-set-background '(255 0 0)) (gimp-drawable-fill uw3-layer 1) (gimp-layer-set-mode uw3-layer MULTIPLY) ; merge down red to grey (clip-to-image) and set mode to screen (set! uw1-layer (car (gimp-image-merge-down img uw3-layer 1))) (gimp-layer-set-mode uw1-layer SCREEN) ; merge down screen to uw (clip-to-image) and set opacity to 50%, tweak up for deep (very green images) or down for shallow (set! uw-layer (car (gimp-image-merge-down img uw1-layer 1))) (gimp-layer-set-opacity uw-layer 50) ; clean (gimp-undo-push-group-end img) (gimp-displays-flush) ) (script-fu-register "script-fu-man" _"/Script-F_u/_Underwater Photos/Red Enhance _1" "Based on the mandrake method for Photoshop. See www.scubaboard.com for the original articles." "www.tankedup-imaging.com" "Tanked Up Underwater Imaging" "06 July 2006" "" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 )