-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFU_photo_BlueSkyClouds.scm
175 lines (165 loc) · 6.97 KB
/
FU_photo_BlueSkyClouds.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
; FU_photo_BlueSkyClouds.scm
; version 3.2 [gimphelp.org]
; last modified/tested by Paul Sherman
; 02/14/2014 on GIMP-2.8.10
; 15/09/2020 on GIMP-2.10.20
;
; See description on author's site:
; http://www.farcrydesign.com/GIMP/BlueSkyClouds.html
;
; 02/14/2014 - convert to RGB if needed
;==============================================================
;
; 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
;
; Blue Sky & Clouds, V2.0
; AUTHOR: Darla McKay ([email protected]), (C) 2007,2008
; This plugin was tested with GIMP 2.4
;
; DESCRIPTION:
; To fix burned out or white skies by adding a blue sky gradient.
; The script is located in menu "<Image> / Script-Fu / Darla / Blue Sky & Clouds"
;
; USAGE NOTES:
; Two colours are selectable, specifying the upper (darker) and lower
; (lighter) sky. The gradient is applied based on a level horizon.
; Threshold masking is applied. Optionally, a layer with rendered clouds
; can be added.
; See http://www.FarcryDesign.com/GIMP/ for more information.
;==============================================================
(define (FU-BlueSkyClouds
InImage
InLayer
InThreshold
InSkyTop
InSkyBottom
InFeather
InClouds
InFlatten
)
(gimp-image-undo-group-start InImage)
(if (not (= RGB (car (gimp-image-base-type InImage))))
(gimp-image-convert-rgb InImage)
)
(let* (
(BlueGradientLayer (car (gimp-layer-copy InLayer TRUE)))
(CloudLayer (car (gimp-layer-copy InLayer TRUE)))
(ThresholdLayer (car (gimp-layer-copy InLayer TRUE)))
(CloudMask (car (gimp-layer-create-mask CloudLayer ADD-MASK-WHITE)))
(BlueGradientMask (car (gimp-layer-create-mask BlueGradientLayer ADD-MASK-WHITE)))
(TheHeight (car (gimp-image-height InImage)))
(Old-FG-Color (car (gimp-context-get-foreground)))
(Old-BG-Color (car (gimp-context-get-background)))
)
; add threshold layer
(gimp-image-insert-layer InImage ThresholdLayer 0 -1)
(gimp-drawable-threshold ThresholdLayer HISTOGRAM-VALUE (/ InThreshold 255) 1.0)
(plug-in-gauss TRUE InImage ThresholdLayer InFeather InFeather 0)
(gimp-item-set-name ThresholdLayer "Threshold Layer")
(gimp-item-set-visible ThresholdLayer FALSE)
; add clouds if applicable, interactive solid noise
(if (not (= InClouds 0))
(begin
(gimp-image-insert-layer InImage CloudLayer 0 -1)
(gimp-selection-all InImage)
(gimp-edit-clear CloudLayer)
(plug-in-solid-noise FALSE InImage CloudLayer 0 0 7 2 3.6 7.4)
(gimp-item-set-name CloudLayer "Cloud Layer")
(gimp-layer-add-mask CloudLayer CloudMask)
(gimp-selection-all InImage)
(gimp-edit-copy ThresholdLayer)
(gimp-floating-sel-anchor (car (gimp-edit-paste CloudMask FALSE)))
(gimp-selection-none InImage)
(gimp-layer-set-mode CloudLayer LAYER-MODE-DARKEN-ONLY)
(gimp-layer-set-opacity CloudLayer 15)
)
)
; add blue gradient layer
(gimp-image-insert-layer InImage BlueGradientLayer 0 -1)
(gimp-context-set-foreground InSkyTop)
(gimp-context-set-background InSkyBottom)
(gimp-edit-blend BlueGradientLayer BLEND-FG-BG-RGB LAYER-MODE-NORMAL GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE FALSE 0 0 TRUE 0 0 0 (- TheHeight 1))
(gimp-item-set-name BlueGradientLayer "Blue Gradient Layer")
(gimp-layer-add-mask BlueGradientLayer BlueGradientMask)
(gimp-selection-all InImage)
(gimp-edit-copy ThresholdLayer)
(gimp-floating-sel-anchor (car (gimp-edit-paste BlueGradientMask FALSE)))
(gimp-selection-none InImage)
(if (not (= InClouds 0))
(begin
(gimp-layer-set-mode BlueGradientLayer LAYER-MODE-HSL-COLOR)
(gimp-layer-set-opacity BlueGradientLayer 90)
)
(begin
(gimp-layer-set-mode BlueGradientLayer LAYER-MODE-DARKEN-ONLY)
(gimp-layer-set-opacity BlueGradientLayer 70)
)
)
; return original color palette, flatten image if needed
(gimp-context-set-foreground Old-FG-Color)
(gimp-context-set-background Old-BG-Color)
(if (= InFlatten TRUE) (gimp-image-flatten InImage))
(gimp-image-undo-group-end InImage)
(gimp-displays-flush)
)
)
(script-fu-register
"FU-BlueSkyClouds"
"<Toolbox>/Script-Fu/Photo/Highlight/Highlight by adding Blue Sky and Clouds"
"Highlights -> Blue Sky & Clouds \n\
To fix burned out or white skies by adding a blue sky \n
gradient and clouds (uses a threshold mask). \n\
USE LOWER THRESHOLD to fill a larger white/highlight area. \n\
See http://www.FarcryDesign.com/GIMP for more information.
\nfile:FU_photo_BlueSkyClouds.scm"
"Darla McKay ([email protected])"
"Darla McKay"
"2007,2008"
"*"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
SF-ADJUSTMENT "Threshold" '(248 0 254 1 0 0 0)
SF-COLOR "Sky Top Color" '(187 219 255)
SF-COLOR "Sky Bottom Color" '(221 234 255)
SF-ADJUSTMENT "Edges: Feather Amount" '(5.0 1.0 10.0 1.0 0 1 0)
SF-TOGGLE "Add Rendered Clouds" TRUE
SF-TOGGLE "Flatten Image" FALSE
)
; end of script