/usr/share/gimp/2.0/scripts/guldahl-red-eye.scm is in gimp-plugin-registry 7.20140602ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | ;
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; Red Eye Correction script for GIMP 2.4
; Copyright (C) 2002 Martin Guldahl <mguldahl@xmission.com>
;
; Tags: photo, red eye
;
; Author statement:
;
; Removes red eye
;
; --------------------------------------------------------------------
; Distributed by Gimp FX Foundry project
; --------------------------------------------------------------------
; - Changelog -
; 0.95 - initial release
;
; --------------------------------------------------------------------
;
; 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 3 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, see <http://www.gnu.org/licenses/>.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (script-fu-red-eye image
drawable
radius
threshold
red
green
blue)
(let* ((select-bounds (gimp-drawable-mask-bounds drawable))
(x1 (cadr select-bounds))
(y1 (caddr select-bounds))
(x2 (cadr (cddr select-bounds)))
(y2 (caddr (cddr select-bounds)))
(red-component 0)
(green-component 1)
(blue-component 2)
)
(gimp-image-undo-group-start image)
; Select and view the green channel only as it has the best contrast
; between the iris and pupil.
; - Deselect the Red and Blue channels
(gimp-image-set-component-active image red-component FALSE)
(gimp-image-set-component-active image blue-component FALSE)
; Use the fuzzy select tool (select contiguous regions) to select the pupils
(gimp-fuzzy-select
drawable
x1 y1
threshold 0 TRUE TRUE radius FALSE
)
; Reselect Red and Blue channels
(gimp-image-set-component-active image red-component TRUE)
(gimp-image-set-component-active image blue-component TRUE)
; Use the channel mixer to make selected area monochrome
(plug-in-colors-channel-mixer
;;run_mode
1
image
drawable
;;monochrome
1
(/ red 100) (/ green 100) (/ blue 100) 0 0 0 0 0 0
)
(gimp-selection-none image)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
)
)
(define (script-fu-red-eye-no-cm image
drawable
radius
threshold
)
(let* ((select-bounds (gimp-drawable-mask-bounds drawable))
(x1 (cadr select-bounds))
(y1 (caddr select-bounds))
(x2 (cadr (cddr select-bounds)))
(y2 (caddr (cddr select-bounds)))
(red-component 0)
(green-component 1)
(blue-component 2)
)
(gimp-image-undo-group-start image)
; Select and view the green channel only as it has the best contrast
; between the iris and pupil.
; - Deselect the Red and Blue channels
(gimp-image-set-component-active image red-component FALSE)
(gimp-image-set-component-active image blue-component FALSE)
; Use the fuzzy select tool (select contiguous regions) to select the pupils
(gimp-fuzzy-select
drawable
x1 y1
threshold 0 TRUE TRUE radius FALSE
)
; Reselect Red and Blue channels
(gimp-image-set-component-active image red-component TRUE)
(gimp-image-set-component-active image blue-component TRUE)
; Now desaturate the Red channel
(gimp-image-set-component-active image red-component TRUE)
(gimp-image-set-component-active image green-component FALSE)
(gimp-image-set-component-active image blue-component FALSE)
(gimp-desaturate drawable)
(gimp-image-set-component-active image red-component TRUE)
(gimp-image-set-component-active image green-component TRUE)
(gimp-image-set-component-active image blue-component TRUE)
(gimp-selection-none image)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
)
)
(script-fu-register "script-fu-red-eye"
_"Red Eye..."
_"Removes red eye; given selection is seed."
"Martin Guldahl <mguldahl@xmission.com>"
"Martin Guldahl"
"2002/10/05"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Radius" '(8 0 100 .2 1 1 1)
SF-ADJUSTMENT _"Threshold" '(40 0 255 1 1 1 1)
SF-ADJUSTMENT _"Red" '(10 0 100 1 1 1 1)
SF-ADJUSTMENT _"Green" '(60 0 100 1 1 1 1)
SF-ADJUSTMENT _"Blue" '(30 0 100 1 1 1 1)
)
(script-fu-menu-register "script-fu-red-eye"
"<Image>/FX-Foundry/Photo/Enhancement")
(script-fu-register "script-fu-red-eye-no-cm"
_"Red Eye Desaturate..."
_"Removes red eye; given selection is seed."
"Martin Guldahl <mguldahl@xmission.com>"
"Martin Guldahl"
"2002/10/05"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Radius" '(8 0 100 .2 1 1 1)
SF-ADJUSTMENT _"Threshold" '(40 0 255 1 1 1 1)
)
(script-fu-menu-register "script-fu-red-eye-no-cm"
"<Image>/FX-Foundry/Photo/Enhancement")
|