-
Notifications
You must be signed in to change notification settings - Fork 1
/
FU_sharpness-softer_softfocus.scm
159 lines (145 loc) · 5.83 KB
/
FU_sharpness-softer_softfocus.scm
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
; FU_sharpness-sharper_softfocus.scm
; version 2.8 [gimphelp.org]
; last modified/tested by Paul Sherman
; 02/15/2014 on GIMP-2.8.10
;
; Modified 12/18/2007 by Paul Sherman
; made compatible with GIMP-2.4
; (define(s), flatten at end and undo setup)
;
; Wed Oct 1 2008 by Paul S.
; Modified deprecated to gimp-levels-stretch
;
; Tue Oct 14 2008 by Paul S.
; Modified to remove passing of image parameter to gimp-layer-add-mask
; (which only requires the layer and the mask) tested OK on GIMP-2.6
;
; 02/15/2014 - accommodated indexed images, merge option added
;==============================================================
;
; Installation:
; This script should be placed in the user or system-wide script folder.
;
; Windows Vista/7/8)
; C:\Program Files\GIMP 2\share\gimp\2.0\scripts
; or
; C:\Users\YOUR-NAME\.gimp-2.8\scripts
;
; Windows XP
; C:\Program Files\GIMP 2\share\gimp\2.0\scripts
; or
; C:\Documents and Settings\yourname\.gimp-2.8\scripts
;
; Linux
; /home/yourname/.gimp-2.8/scripts
; or
; Linux system-wide
; /usr/share/gimp/2.0/scripts
;
;==============================================================
;
; LICENSE
;
; 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/>.
;
;==============================================================
; Original information
;
; copyright 2006, Y.Morikaku
; August 15, 2006
;==============================================================
(define (FU-soft-focus
theImage
theLayer
edge
mode
opacity
inMerge
)
(gimp-image-undo-group-start theImage)
(if (not (= RGB (car (gimp-image-base-type theImage))))
(gimp-image-convert-rgb theImage)
)
(define addString (cond ((= mode 0) "_super-softfocus_h.jpg" )
((= mode 1) "_super-softfocus_a.jpg" )
((= mode 2) "_super-softfocus_s.jpg" )
((= mode 3) "_super-softfocus_dv.jpg" )
('else "_super-softfocus_ds.jpg" )
)
)
(let* (
(dummy 0)
(theLayer2 0)
(theLayer3 0)
(mask 0)
)
(set! theLayer2 (car (gimp-layer-copy theLayer 1)))
(gimp-image-insert-layer theImage theLayer2 0 0)
(plug-in-gauss-iir2 1 theImage theLayer2 10 10)
(set! theLayer3 (car (gimp-layer-copy theLayer2 1)))
(gimp-image-insert-layer theImage theLayer3 0 0)
(set! mask (car (gimp-layer-create-mask theLayer3 ADD-MASK-COPY)))
(gimp-layer-add-mask theLayer3 mask)
(define theLayer4 (car(gimp-layer-copy theLayer3 1)))
(gimp-image-insert-layer theImage theLayer4 0 0)
(gimp-layer-set-mode theLayer2 LAYER-MODE-SCREEN)
(gimp-layer-set-mode theLayer3 LAYER-MODE-MULTIPLY)
(gimp-layer-set-mode theLayer4 LAYER-MODE-OVERLAY)
(define theLayer5 (car(gimp-layer-copy theLayer 1)))
(gimp-image-insert-layer theImage theLayer5 0 0)
(define mask5 (car (gimp-layer-create-mask theLayer5 ADD-MASK-COPY)))
(gimp-layer-add-mask theLayer5 mask5)
(plug-in-edge 1 theImage mask5 1 1 0)
(plug-in-blur 1 theImage mask5)
(gimp-levels-stretch mask5)
(gimp-layer-set-opacity theLayer5 edge)
(gimp-edit-copy-visible theImage)
(define theLayer6 (car (gimp-edit-paste theLayer FALSE)))
(define pastedLayer (car (gimp-image-get-active-layer theImage)))
(define pastedLayerMode (cond ((= mode 0) LAYER-MODE-HARDLIGHT )
((= mode 1) LAYER-MODE-ADDITION )
((= mode 2) LAYER-MODE-SCREEN )
((= mode 3) LAYER-MODE-DIVIDE )
(else LAYER-MODE-NORMAL )
)
)
(gimp-layer-set-mode pastedLayer pastedLayerMode )
(if (>= mode 4)
(begin
(gimp-desaturate pastedLayer)
(define maskPasted (car (gimp-layer-create-mask pastedLayer ADD-MASK-COPY)))
(gimp-layer-add-mask pastedLayer maskPasted )
);end of begin
);end of if
(gimp-layer-set-opacity pastedLayer opacity )
(if (= inMerge TRUE)(gimp-image-merge-visible-layers theImage EXPAND-AS-NECESSARY))
(gimp-image-undo-group-end theImage)
(gimp-displays-flush)
)
);end of define
(script-fu-register "FU-soft-focus"
"<Image>/Script-Fu/Photo/Sharpness/Softer/Soft Focus - SuperSoft"
"Super Softfocus 1.1 / Layer mode select version.\n\nFlattens image if needed before doing its work. \nfile:FU_sharpness-softer_softfocus.scm"
"Y Morikaku"
"copyright 2006, Y.Morikaku"
"August 15, 2006"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Edge Strength" '(50 0 100 1 10 0 0)
SF-OPTION "Top Layer Mode" '( "HARDLIGHT-MODE" "ADDITION" "SCREEN" "DIVIDE" "Desaturation" )
SF-ADJUSTMENT "Top Layer Opacity" '(30 0 100 1 10 0 0)
SF-TOGGLE "Merge layers when complete?" TRUE
)
;end of script