Wed, 05 Aug 2009 15:00:54 +0100
small changes to hexdump code to stop a gcc warning on platforms where sizeof(int) != sizeof(int*) e.g. x86_64
1 #
2 # File : gmic_def.raw
3 # ( G'MIC default macro file )
4 #
5 # Description : Define additional commands for G'MIC (GREYC's Magic Image Converter).
6 # ( http://gmic.sourceforge.net )
7 # This file is also a part of the CImg Library project.
8 # ( http://cimg.sourceforge.net )
9 #
10 # Usage : gmic [-m gmic_def.raw] (...)
11 #
12 # Note : This file is here for illustration purposes, since commands defined in
13 # the default macro file are already present by default in G'MIC.
14 # Then, explicit inclusion of this file (using the '-m' option) if
15 # useless.
16 #
17 # Copyright : David Tschumperle
18 # ( http://www.greyc.ensicaen.fr/~dtschump/ )
19 #
20 # License : CeCILL v2.0
21 # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
22 #
23 # This software is governed by the CeCILL license under French law and
24 # abiding by the rules of distribution of free software. You can use,
25 # modify and/ or redistribute the software under the terms of the CeCILL
26 # license as circulated by CEA, CNRS and INRIA at the following URL
27 # "http://www.cecill.info".
28 #
29 # As a counterpart to the access to the source code and rights to copy,
30 # modify and redistribute granted by the license, users are provided only
31 # with a limited warranty and the software's author, the holder of the
32 # economic rights, and the successive licensors have only limited
33 # liability.
34 #
35 # In this respect, the user's attention is drawn to the risks associated
36 # with loading, using, modifying and/or developing or reproducing the
37 # software by the user in light of its specific status of free software,
38 # that may mean that it is complicated to manipulate, and that also
39 # therefore means that it is reserved for developers and experienced
40 # professionals having in-depth computer knowledge. Users are therefore
41 # encouraged to load and test the software's suitability as regards their
42 # requirements in conditions enabling the security of their systems and/or
43 # data to be ensured and, more generally, to use and operate it in the
44 # same conditions as regards security.
45 #
46 # The fact that you are presently reading this means that you have had
47 # knowledge of the CeCILL license and that you accept its terms.
48 #
50 #----------------------------------------
51 #
52 # Get and display image characteristics
53 #
54 #----------------------------------------
56 # Compute image gradient norm.
57 #-----------------------------
58 #@gmic gradient_norm : (no args) : Compute gradient norm of the last image.
59 gradient_norm :
60 -e "Compute gradient norm of the last image."
61 -v- -t float -gradient[-1] xyz -a[-3--1] v -norm[-1] -sqrt[-1] -v+
63 # Compute image gradient orientation in 'N'-D.
64 #---------------------------------------------
65 #@gmic gradient_orientation : N=3 : Compute N-D gradient orientation of the last image.
66 _gradient_orientation3 :
67 -gradient[-1] xyz --sqr[-3--1] -+[-3--1] -+[-1] 1e-8 -sqrt[-1] -/[-4,-3] [-1] -/[-2,-1]
68 _gradient_orientation2 :
69 -gradient[-1] xy --sqr[-2,-1] -+[-2,-1] -+[-1] 1e-8 -sqrt[-1] -/[-3] [-1] -/[-2,-1]
70 _gradient_orientation1 :
71 -gradient[-1] x --abs[-1] -+[-1] 1e-8 -/[-2,-1]
72 gradient_orientation : -int ${1=3}
73 -v- -if $1 (4) --[-1] $1 -if @-1 -rm[-1]
74 -v+ -e "Compute $1-D gradient orientation of the last image." -v-
75 -t float -_gradient_orientation$1 -else -v+ -e "Invalid argument '$1', should be '{1,2,3}'." -q
76 -endif -else -v+ -e "Invalid argument '$1', should be '{1,2,3}'." -q
77 -endif -v+
79 # Compute image laplacian.
80 #-------------------------
81 #@gmic laplacian : (no args) : Compute Laplacian of the last image.
82 laplacian :
83 -e "Compute image laplacian of the last image."
84 -v- -t float -hessian[-1] xxyyzz -+[-3--1] -v+
86 # Compute oriented second derivative in the gradient direction.
87 #--------------------------------------------------------------
88 #@gmic gradient_2derivative : (no args) : Compute gradient-directed 2nd derivative of the last image.
89 gradient_2derivative :
90 -e "Compute gradient-directed 2nd derivative of the last image."
91 -v- -t float --gradient[-1] xyz -hessian[-4] xxxyxzyyyzzz
92 --sqr[-3] -*[-10,-1] --sqr[-2] -*[-7,-1] --sqr[-1] -*[-5,-1]
93 -*[-8,-7,-5] 2 -*[-8] [-3] -*[-8] [-2] -*[-7] [-3] -*[-7] [-1] -*[-5] [-2] -*[-5] [-1]
94 -+[-9--4] -sqr[-3--1] -+[-3--1] -+[-1] 1e-8 -/[-2,-1] -v+
96 # Difference of Gaussians.
97 #-------------------------
98 #@gmic dog : 'sigma1=2','sigma2=3' : Compute edges in the last image by using difference of gaussian-filtered images.
99 dog : -float ${1=2},${2=3}
100 -e "Compute edges in the last image by difference of gaussian-filtered images, with standard deviations $1 and $2."
101 -v- -t float --blur[-1] $1 -blur[-2] $2 --[-1,-2] -norm[-1] -v+
103 # Estimate isophote curvatures.
104 #------------------------------
105 #@gmic curvature : (no args) : Estimate isophote curvatures of the last image.
106 curvature :
107 -e "Estimate isophote curvatures of the last image."
108 -v- [-1]x2 -laplacian -mv[-1] -2 -gradient_2derivative --[-2,-1]
109 -mv[-1] -2 -gradient_norm -+[-1] 1e-8 -/[-2,-1] -v+
111 # Complex<->polar transform (the two last images give the real and imaginary parts).
112 #-----------------------------------------------------------------------------------
113 #@gmic complex2polar : (no args) : Compute complex->polar transform (two last images are real and imaginary parts).
114 complex2polar :
115 -e "Compute complex to polar transform."
116 -v- -t float -+[-2] 1e-8 --/[-1] [-2] -atan[-1] -sqr[-3,-2] -+[-3,-2] -sqrt[-2] -v+
118 #@gmic polar2complex : (no args) : Compute polar->complex transform (two last images are real and imaginary parts).
119 polar2complex :
120 -e "Compute polar to complex transform."
121 -v- -t float [-1] -cos[-2] -sin[-1] -*[-1] [-3] -*[-3,-2] --[-2] 1e-8 -v+
123 # Fourier transform viewer with centered log-module and centered argument.
124 #-------------------------------------------------------------------------
125 #@gmic display_fft : (no args) : Display Fourier transform of the last image with centered log-module and argument (eq. to '-dfft').
126 display_fft :
127 -e "Display Fourier transform of the last image."
128 -v- -t float -fft[-1] -complex2polar -translate[-2,-1] 50%,50%,50%,0,2 -log[-2] -n 0,255 -v+
129 dfft :
130 -display_fft
132 # Render a RGBA image over a user-defined background.
133 #----------------------------------------------------
134 #@gmic compose_rgba : (no args) : Render a RGBA image (last image) over a RGB background (penultimate image).
135 compose_rgba :
136 -e "Compose RGBA image with RGB background."
137 -v- --[-1] 255 -r[-1] 100%x100%x1x4x0 -+[-1] 255 -r[-1] [-2],[-2],[-2],4,0
138 -s[-1] v -a[-4--2] v -/[-1] 255 [-1] -negative -r[-4--1] 100%x100%x1x3
139 -*[-4,-1] -*[-2,-1] -+[-2,-1] -v+
141 # Render a RGBA image over a synthetic checkerboard background.
142 #--------------------------------------------------------------
143 #@gmic display_rgba : (no args) : Render a RGBA image (last image) over a synthetic background (eq. to '-drgba').
144 display_rgba :
145 -e "Render RGBA image over synthetic background."
146 -v- 2x2 -f[-1] 160,128,128,160 -mv[-1] -2 -r[-2] 16x16 -r[-2] [-1]x[-1]x1x3,0,2 -compose_rgba -v+
147 drgba :
148 -display_rgba
150 #-----------------------------
151 #
152 # Geometric filters
153 #
154 #-----------------------------
156 # Image array.
157 #-------------
158 #@gmic array : 'M=3,N=M' : Create a MxN array from the last image.
159 array : -int ${1=3},${2=$1}
160 -e "Create a $1x$2 array from last image."
161 -v- [-1]x$1 -rm[-1] -a[-$1--1] x [-1]x$2 -rm[-1] -a[-$2--1] y -v+
163 # Tiled array.
164 #-------------
165 #@gmic array_tile : 'M=3,N=M' : Create a MxN fade-tiled array from the last image.
166 array_tile : -int ${1=3},${2=$1}
167 -e "Create a $1x$2 fade-tiled array from the last image."
168 -v- --translate[-1] 50%x50%x1x1,2 -mv[-1] -2 -fade_diamond 80,90 -array $1,$2 -v+
170 # Mirror-tiled image.
171 #--------------------
172 #@gmic mirror_tile : 'N=2' : Create a NxN mirror-tiled version of the last image.
173 _mirror_tile :
174 [-1]x3 -mirror[-3,-1] x -mirror[-2,-1] y -a[-4,-3] x -a[-2,-1] x -a[-2,-1] y
175 mirror_tile : -int ${1=2}
176 -e "Create a $1x mirror-tiled version of the last image."
177 -v- -i[0] ($1) --[0] 1 -repeat @0 -_mirror_tile -done -rm[0] -v+
179 # Taquin puzzles.
180 #----------------
181 #@gmic taquin : 'M=4,N=M' : Create a MxN taquin puzzle from the last image.
182 _taquin :
183 -i @0 -rand[-1] @0,1 -*[-1] -1 -round[-1] 1 --[-1] 1 -reverse[@-1] -rm[-1]
184 taquin : -int ${1=4},${2=$1}
185 -e "Create $1x$2 taquin puzzle from the last image."
186 -v- -i[0] ($1) -*[0] $2 -split_tile $1,$2 -repeat 10 -_taquin -done -rm[0] -append_tile $1,$2 -v+
188 # Image grids.
189 #-------------
190 #@gmic grid : 'M=10,N=M' : Create a MxN grid version of the last image.
191 grid : -int ${1=10},${2=$1}
192 -e "Create $1x$2 grid version of the last image."
193 -v- -i[-2] $1x$2 -f[-2] 1 --translate[-2] -1,-1 --[-3,-1] -*[-2] -1
194 -+[-2] 1 --dimensions[-1] -s[-1] y -/[-4] $1 -/[-3] $2 (2) -a[-5--1] y
195 -round[-1] 1,-1 -r[-2] @-1 -s[-1] y -rm[-1] -*[-4] $1 -*[-3] $2 -a[-4--1] y -r[-2] @-1
196 (0;2) -a[-2,-1] y -r[-3] @-1 -rm[-1] -r[-1] [-2] -*[-2,-1] -v+
198 # Insert colored frames around image.
199 #------------------------------------
200 #@gmic frame : 'W=20,H=W,R=255,G=255,B=255' : Insert a WxH RGB-colored frame around the last image.
201 _framex :
202 -i 1,1,1,3 -f[-1] $2,$3,$4 -r[-1] $1,[-2],[-2],[-2],1 -i[-3] [-1] -a[-3--1] x
203 _framey :
204 -i 1,1,1,3 -f[-1] $2,$3,$4 -r[-1] [-2],$1,[-2],[-2],1 -i[-3] [-1] -a[-3--1] y
205 frame : -int ${1=20},${2=$1} -float ${3=255},${4=$3},${5=$4}
206 -e "Insert a $1x$2 frame with RGB color ($3,$4,$5) in the last image."
207 -v- -_framex $1,$3,$4,$5 -_framey $2,$3,$4,$5 -v+
209 # Draw a colored fuzzy frame around image.
210 #-----------------------------------------
211 #@gmic frame_fuzzy : 'W=20,H=W,fuzzyness=3,smoothness=3,R=255,G=255,B=255' : Draw a WxH RGB-colored fuzzy frame around the last image.
212 frame_fuzzy : -int ${1=20},${2=$1} -float ${3=5},${4=1},${5=255},${6=$5},${7=$6}
213 -e "Draw a $1x$2 fuzzy frame with RGB color ($5,$6,$7), fuzzyness $3 and smoothness $4 in the last image."
214 -v- -i[0] ($1;$2) -*[0] 2 1x1x1x3 -f[-1] $5,$6,$7 -r[-1] [-2] 100%x100%
215 -polygon[-1] 4,0,0,100%,0,100%,@{0,1},0,@{0,1},1,1
216 -polygon[-1] 4,0,0,@{0,0},0,@{0,0},100%,0,100%,1,1
217 -rm[0] -translate[-1] $1,$2,0,0,2 -spread $3 -blur[-1] $4 -_fade 50,80 -v+
219 # Polaroid effect.
220 #-----------------
221 #@gmic polaroid : 'W1=30,W2=120,W3=40' : Create polaroid from last image, with specified border sizes.
222 polaroid : -int ${1=30},${2=120},${3=40}
223 -e "Create polaroid effect from the last image with borders $1, $2 and $3."
224 -v- -frame $1,$1,255,255,255 [-1],$2,1,3 -f[-1] 255 -a[-2,-1] y
225 --dimensions[-1] -+[-1] $3 -+[-1] $3 --f[-2] -1 -r[-1] @{-2,0-1},1,3,0,0,1 -rm[-2]
226 -blur[-1] 5 -r[-2] [-1],0,0,1 -n[-1] 0,180 -or[-2,-1] -v+
228 # Drop shadow.
229 #-------------
230 #@gmic drop_shadow : '(no args) : Add a drop shadow behind the last image.
231 drop_shadow :
232 -e "Add a drop shadow behind the last image."
233 -v- --f[-1] 0 --[-1] 255 -r[-2,-1] 120%x120%x1x100%,0,0,1 -+[-1] 255 --blur[-1] 10 -translate[-3,-2] 10,10,0,0,1
234 -*[-2,-1] -n[-1] 0,255 -+[-2,-1] -v+
236 # Split into tiles.
237 #------------------
238 #@gmic split_tile : 'M=8,N=M' : Split last image into MxN regular tiles.
239 split_tile : -int ${1=8},${2=$1}
240 -e "Decompose last image into $1x$2 regular tiles."
241 -v- -i[0] ($1) -*[0] $2 -s[-1] x,$1 -s[-$1--1] y,$2 -r[-@0--1] [-@0],0 -rm[0] -v+
243 # Append tiles.
244 #--------------
245 #@gmic append_tile : 'M=8,N=M' : Append last MxN regular tiles together.
246 append_tile : -int ${1=8},${2=$1}
247 -e "Append last $1x$2 regular tiles together."
248 -v- -i[0] ($1) -*[0] $2 -a[-@0--1] y -s[-1] y,$1 -a[-$1--1] x -rm[0] -v+
250 # Rotate tiles.
251 #---------------
252 #@gmic rotate_tile : 'angle=5,M=8,N=M' : Apply MxN tiled-rotation effect on the last image.
253 rotate_tile : -float ${1=5} -int ${2=8},${3=$2}
254 -e "Apply $2x$3 tiled-rotation effect on the last image, with angle $1."
255 -v- -i[0] ($2) -*[0] $3 -split_tile $2,$3 -rotate[-@0--1] $1 -append_tile $2,$3 -v+
257 # Tiled shift.
258 #-------------
259 #@gmic shift_tile : 'amplitude=20,M=8,N=M' : Apply MxN tiled-shift effect on the last image.
260 shift_tile : -float ${1=20} -int ${2=8},${3=8}
261 -e "Apply $2x$3 tiled-shift effect on the last image, with amplitude $1."
262 -v- -t float $2x$3x1x2 -noise[-1] $1 -r[-1] [-2],[-2],1,2 -warp[-2] [-1],1,1,0 -rm[-1] -v+
264 #-----------------------------
265 #
266 # Deformation filters
267 #
268 #-----------------------------
270 # Spread pixel values.
271 #---------------------
272 #@gmic spread : 'dx=3,dy=dx,dz=0' : Spread last image pixel values randomly along x,y and z.
273 spread : -float ${1=3},${2=$1},${3=0}
274 -e "Spread pixel values of the last image with amplitudes ($1,$2,$3))."
275 -v- -t float 100%x100%x100%x1x3 -noise[-3] $1,0 -noise[-2] $2,0
276 -noise[-1] $3,0 -a[-3--1] v -warp[-2] [-1],1 -rm[-1] -v+
278 # Water effect.
279 #--------------
280 #@gmic water : 'amplitude=30,smoothness=1.5' : Apply water effect on the last image.
281 water : -float ${1=30},${2=1.5}
282 -e "Apply water effect on the last image, with amplitude $1 and smoothness $2."
283 -v- -t float 25%x25%x25%x1 -noise[-1] $1 -gradient[-1] xyz -+[-1,-2,-3]
284 -blur[-1] $2 -*[-1] 2 -warp[-2] [-1],1 -rm[-1] -v+
286 # Wave effect.
287 #-------------
288 #@gmic wave : 'amplitude=4,frequency=0.4' : Apply wave effect on the last image.
289 wave : -float ${1=4},${2=0.4}
290 -e "Apply wave effect on the last image, with amplitude $1 and frequency $2."
291 -v- -t float (1) -r[-1] [-2],[-2],1,1,0,0,1 -distance[-1] 1
292 -*[-1] $2 [-1] -cos[-2] -sin[-1] -a[-2,-1] v -*[-1] $1
293 -warp[-2] [-1],1 -rm[-1] -v+
295 # Linear blur.
296 #-------------
297 #@gmic blur_linear : 'amplitude=10,vx=1,vy=0' : Apply oriented linear blur on the last image.
298 _blur_linear :
299 --warp[-2] [-1],1,1,1 -*[-2] -1 -warp[-3] [-2],1,1,1 -+[-3,-1] -/[-2] 2 -*[-1] -1
300 blur_linear : -int ${1=10} -float ${2=1},${3=0}
301 -e "Apply linear blur on the last image, with amplitude $1 and orientation ($2,$3)."
302 -v- -t float 1x1x1x2 -f[-1] $2,$3 -r[-1] [-2],[-2],1,2 -repeat $1 -_blur_linear -done -rm[-1] -v+
304 # Radial blur.
305 #-------------
306 #@gmic blur_radial : 'amplitude=10,angle=0.5' : Apply radial blur on the last image.
307 _blur_radial :
308 --rotate[-1] @-2,-2,0 -*[-3] -1 -rotate[-2] @-3,-2,0 -*[-3] -1 -+[-2,-1] -/[-1] 2
309 blur_radial : -int ${1=10} -float ${2=0.5}
310 -e "Apply radial blur on the last image, with amplitude $1 and angle $2."
311 -v- -t float [-1] -i[-2] ($2) -repeat $1 -_blur_radial -+[-2] $2 -done -v+
313 # Zoom blur.
314 #-----------
315 #@gmic blur_zoom : 'amplitude=5,zoom_step=1.5' : Apply radial blur on the last image.
316 _blur_zoom :
317 --r[-1] @0%x@0%x@0%x100%,2 -r[-1] [-2],0,1,1 -+[-2,-1] -/[-1] 2
318 blur_zoom : -int ${1=5} -float ${2=1.5}
319 -e "Apply zoom blur on the last image, with amplitude $1 and step $2."
320 -v- -t float -i[0] ($2) -+[0] 100 -repeat $1 -_blur_zoom -done -rm[0] -v+
322 # Generic macro for applying a PDE flow.
323 #---------------------------------------
324 pde_flow :
325 -v- -t float -repeat $2 -if $1 [-1] -endif
326 $4 ${5*} ($3) --stats[-2] -r[-1] 1x2x1x1,0 -abs[-1] -stats[-1] -i (@{-1,1}) -rm[-2]
327 -+[-1] 0.1 -/[-2,-1] -*[-2] @-1 -rm[-1] -+[-2,-1] -done -v+
329 # Mean-curvature flow.
330 #---------------------
331 #@gmic meancurvature_flow : 'nb_iter=5, time_step=30, seq=0' : Apply iterations of the mean curvature flow on the last image.
332 _meancurvature_flow :
333 [-1]x2 -laplacian -mv[-1] -2 -gradient_2derivative --[-2,-1]
334 meancurvature_flow : -int ${1=5},${3=0} -float ${2=30}
335 -e "Apply $1 iterations of the mean curvature flow, with time step $2."
336 -pde_flow $3,$1,$2,-_meancurvature_flow
338 # Total variation flow.
339 #---------------------
340 #@gmic tv_flow : 'nb_iter=5, time_step=20, seq=0' : Apply iterations of the total variation flow on the last image.
341 _tv_flow :
342 [-1]x3 -laplacian -mv[-1] -3 -gradient_2derivative --[-3,-1] -gradient_norm -+[-1] 0.5 -r[-1] [-2] -/[-2,-1]
343 tv_flow : -int ${1=5},${3=0} -float ${2=20}
344 -e "Apply $1 iterations of the total variation flow, with time step $2."
345 -pde_flow $3,$1,$2,-_tv_flow
347 # Hurl noise.
348 #------------
349 #@gmic noise_hurl : 'amplitude' : Add hurl noise to the last image.
350 noise_hurl : -float ${1=10}
351 -e "Add hurl noise of amplitude $1% on the last image."
352 -v- --stats --f[-2] 0 -noise[-1] 10 -n[-1] @{-2,0,1} -rm[-2] 100%x100% -f[-1] -2
353 -noise[-1] $1,2 -threshold[-1] 0 -r[-1] [-2]
354 -*[-2] [-1] -*[-1] -1 -+[-1] 1 -*[-3,-1] -+[-2,-1] -v+
356 # Pixelize.
357 #----------
358 #@gmic pixelize : 'sx=30,sy=sx' : Pixelize the last image with specified scales ('sx' and 'sy' in 0..100).
359 pixelize : -float ${1=20},${2=$1}
360 -e "Pixelize last image with scales ($1%,$2%)."
361 -v- --dimensions[-1] -r[-2] $1%x$2%x1x3,2 -r[-2] @-1 -rm[-1] -v+
363 # Deforming filter.
364 #------------------
365 #@gmic deform : 'amplitude=10' : Apply random smooth deformation on the last image.
366 deform : -float ${1=10}
367 -e "Apply random smooth deformation on the last image, with amplitude $1."
368 -v- -t float 2%x2%x1x2 -noise[-1] $1 -r[-1] [-2],[-2],1,2,5
369 -warp[-2] [-1],1,1,1 -rm[-1] -v+
371 # Puzzle filter.
372 #---------------
373 #@gmic puzzle : (no args) : Apply puzzle effect on the last image.
374 puzzle :
375 -e "Apply puzzle effect on the last image."
376 -v- -t float [-1] -r[-1] 5%x5%x100%x100%x2 -noise[-1] 0.1 -r[-1] [-2] -rm[-2]
377 [-1]x2 -translate[-1] 1,1 --[-2,-1] -norm[-1] -threshold[-1] 0.01 -*[-1] -1
378 -+[-1] 1 -r[-1] [-2] -*[-1,-2] 10%x10%x10%x2 -noise[-1] 5,1
379 -r[-1] [-2],[-2],1,2,5 -warp[-2] [-1],1,1,1 -rm[-1] -v+
381 # Fish-eye.
382 #----------
383 #@gmic fish_eye : 'amplitude=250' : Apply Fish-eye effect on the last image.
384 fish_eye : -float ${1=250}
385 -e "Apply Fish-eye effect on the last image, with amplitude $1."
386 -v- -t float 2x2x1x2 -f[-1] -1,1,-1,1,-1,-1,1,1 -r[-1] [-2],[-2],1,2,3 [-1]
387 -norm[-2] -n[-2] 0,1 -cut[-2] 0,0.7 --[-2] 0.7 -*[-2] -$1 -r[-2] [-1]
388 -*[-2,-1] -warp[-2] [-1],1,1,1 -rm[-1] -v+
390 #-----------------------------
391 #
392 # Artistic filters
393 #
394 #-----------------------------
396 # Add strip shades along x or y.
397 #-------------------------------
398 #@gmic shade_stripes : 'frequency=5, direction=1' : Add horizontal or vertical shaded stripes on the last image.
399 _shade_stripes0 :
400 -v+ -e "Add horizontal shaded stripes on the last image, with frequency $1." -v- 1x100%
401 _shade_stripes1 :
402 -v+ -e "Add vertical shaded stripes on the last image, with frequency $1." -v- 100%
403 shade_stripes : -float ${1=5} -int ${2=1}
404 -v- -t float -n[-1] 0,255 -_shade_stripes$2 $1 -noise[-1] $1,2 -distance[-1] 1
405 -r[-1] [-2] -n[-1] 0.3,1.5 -*[-1,-2] -cut[-1] 0,255 -v+
407 # Add old-movie stripes.
408 #-----------------------
409 #@gmic stripesy : 'frequency=10' : Add vertical stripes on the last image.
410 stripesy : -float ${1=10}
411 -e "Add vertical stripes on the last image, with frequency $1."
412 -v- -t float -n[-1] 0,255 100% -noise[-1] $1,2 -*[-1] 255 -r[-1] [-2]
413 -*[-1] 0.15 -+[-1,-2] -cut[-1] 0,255 -v+
415 # Tetris effect.
416 #---------------
417 #@gmic tetris : 'scale=10' : Apply tetris effect of given size on the last image.
418 tetris : -float ${1=10}
419 -e "Apply tetris effect on the last image, with scale $1."
420 -v- -t float [-1] -r[-1] $1%x$1%x$1%x3x2 -n[-1] 0,255 -quantize[-1] 10
421 -r[-1] [-2] -rm[-2] -blur[-1] 2 -sharpen[-1] 300,1 -v+
423 # Damp patch effect.
424 #-------------------
425 #@gmic damp_patch : 'opacity=0.7' : Apply damp patch effect on the last image.
426 damp_patch : -float ${1=0.7}
427 -e "Apply damp patch effect on the last image, with opacity $1."
428 -v- -t float 100%x100% -f[-1] 1 -translate[-1] 2,2 -translate[-1] -1,-1
429 -plasma[-1] 3,0.3 -abs[-1] -blur[-1] 1 -cut[-1] 3%,15% -r[-1] [-2]
430 -n[-1] $1,1 -*[-1,-2] -v+
432 # Light patch effect.
433 #--------------------
434 #@gmic light_patch : 'darkness=0.9,lightness=1.7' : Apply light patch effect on the last image.
435 light_patch : -float ${1=0.9},${2=1.7}
436 -e "Apply light patch effect on the last image, with darkness $1 and lightness $2."
437 -v- -t float -n[-1] 0,255 2%x2% -noise[-1] 40 -r[-1] [-2],5 -cut[-1] 0,255
438 -n[-1] $1,$2 -*[-2,-1] -cut[-1] 0,255 -v+
440 # Mosaic pattern.
441 #----------------
442 #@gmic mosaic : 'density=0.2' : Add mosaic pattern to the last image.
443 mosaic : -float ${1=0.2}
444 -e "Add mosaic pattern on the last image, with density $1."
445 -v- -t float 100%x100%x1x1 -noise[-1] $1,2 -distance[-1] 1
446 -sharpen[-1] 10000 -*[-1] -1 -blur[-1] 0.5 -n[-1] 0.3,1 -r[-1] [-2] -*[-2,-1] -v+
448 # Sponge filter.
449 #---------------
450 #@gmic sponge : 'size=13' : Apply sponge filter on the last image with specified brush size.
451 _circle :
452 -i 1 -+[-1] 1 -r[-1] $1x$1x1x1x0,0,1 -distance[-1] 1 -n[-1] 0,1 -sqrt[-1] -cut[-1] 0.85,0.86 -*[-1] -1 -n[-1] 0,1
453 sponge : -int ${1=13}
454 -e "Apply sponge filter on the last image, with brush size $1."
455 -v- 100%x100%x1x1 -noise[-1] 20,2 -r[-1] [-2] -n[-1] 0,1 -*[-1,-2]
456 -_circle $1 -dilate[-2] [-1] -rm[-1] -v+
458 # Heart filter.
459 #--------------
460 #@gmic hearts : (no args) : Apply heart filter on the last image.
461 _heart9x7 :
462 -i 9x7 -f[-1] 0,1,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0
463 hearts :
464 -e "Apply heart filter on the last image."
465 -v- 100%x100%x1 -noise[-1] 10,2 -r[-1] [-2] -n[-1] 0,1 -*[-1,-2] -_heart9x7
466 -mirror[-1] y -dilate[-2] [-1] -rm[-1] -v+
468 # Color ellipses.
469 #----------------
470 #@gmic color_ellipses : 'opacity=0.07' : Add random colored ellipses on the last image.
471 _color_ellipses :
472 -i 10 -f[-1] @{-2,0-9} -ellipse[-3] @-1 -rm[-1] -translate[-1] 0,1
473 color_ellipses : -float ${1=0.07}
474 -e "Add random colored ellipses to the last image, with opacity $1."
475 -v- --dimensions[-1] -r[-1] 2x2x1x1x0 -mirror[-1] x 1x400 -rand[-1] @{-2,0,1} --rand[-1] @{-2,2,3}
476 -rm[-3] 2x[-1] --dimensions[-4] -r[-1] 2x2x1x1x0 -s[-1] y
477 -+[-2,-1] -mirror[-1] x -rand[-2] @{-1,0,1} -rm[-1] -/[-1] 10 --rand[-1] -1,1
478 1x[-1] -f[-1] $1 3x[-1] -rand[-1] 10,255 -a[-6--1] x -repeat 400 -_color_ellipses -done -rm[-1] -v+
480 # Whirls texture.
481 #----------------
482 #@gmic whirls : (no args) : Add random whirl texture on the last image.
483 whirls :
484 -e "Add random whirl texture to the last image."
485 -v- -n[-1] 0,255 -t float [-1] -f[-1] 0 -noise[-1] 0.3,2 -blur[-1] 3
486 -gradient[-1] xyz -a[-3--1] v -norm[-1] -sqrt[-1] -blur[-1] 3 -gradient[-1] xyz
487 -a[-3--1] v -norm[-1] -sqrt[-1] -blur[-1] 3 -gradient[-1] xyz -a[-3--1] v
488 -norm[-1] -sqrt[-1] -blur[-1] 3 -gradient[-1] xyz -a[-3--1] v -norm[-1]
489 -sqrt[-1] -n[-1] 0.8,1.5 -r[-1] [-2] -*[-2,-1] -cut[-1] 0,255 -v+
491 # Add water reflection.
492 #----------------------
493 #@gmic reflect : (no args) : Add water reflection effect to the last image.
494 reflect :
495 -e "Add water reflection effect to the last image."
496 -v- -t float [-1] -mirror[-1] y -r[-1] 100%x100%x100%x3 -s[-1] v -*[-3] 0.8
497 -*[-2] 0.9 -a[-3--1] v -water 30,1.5 1x2 -f[-1] 1,0 -r[-1] [-2]x3 -*[-2,-1]
498 -a[-2,-1] y -v+
500 # B&W Edge filter.
501 #-----------------
502 #@gmic edges : 'threshold=30' : Estimate image contours of the last image.
503 edges : -float ${1=30}
504 -e "Estimate last image contours, with threshold $1."
505 -v- -t float [-1] -n[-1] 0,255 -gradient_norm -blur[-1] 0.5
506 -threshold[-1] $1% -distance[-1] 0 -equalize[-1] 256 -*[-1] -1 -n[-1] 0,255
507 -r[-1] [-2] -rm[-2] -v+
509 # Cartoon effect.
510 #----------------
511 #@gmic cartoon : 'threshold=30' : Apply cartoon effect on the last image.
512 cartoon : -float ${1=30}
513 -e "Apply cartoon effect on the last image, with threshold $1."
514 -v- -t float [-1]x2 -edges $1 -r[-2] 8x8x1x3,2 -r[-3] 100%x100%x100%x3
515 -rgb2lut[-3] [-2] -lut2rgb[-3] [-2] -rm[-2] -blur[-2] 2 -*[-2--1] -n[-1] 0,255 -v+
517 # Drawing effect.
518 #----------------
519 #@gmic drawing : (no args) : Apply drawing effect on the last image.
520 drawing :
521 -e "Apply drawing effect on the last image."
522 -v- -t float -smooth[-1] 200,0.2,1,3,3 -blur[-1] 2 -sharpen[-1] 1000 [-1]
523 -r[-2] 20x20x1x3,2 -equalize[-2] 256 -rgb2lut[-1] [-2],1 -lut2rgb[-1] [-2] -rm[-2] -v+
525 # Whirl drawing effect.
526 #----------------------
527 #@gmic draw_whirl : (no args) : Apply whirl drawing effect on the last image.
528 draw_whirl :
529 -e "Apply whirl drawing effect on the last image."
530 -v- -t float 100%x100% -noise[-1] 70,2 -*[-1] 255 -r[-1] [-2] -and[-1,-2] -smooth[-1] 100,0,1,2,2
531 -sqrt[-1] -n[-1] 0,255 -equalize[-1] 256 -v+
533 # Paper texture.
534 #---------------
535 #@gmic paper_texture : (no args) : Add paper texture to the last image.
536 paper_texture :
537 -e "Add paper texture to the last image."
538 -v- -t float [-1] 30%x30% -noise[-1] 1,2 -r[-1] [-2],[-2],[-2],1,0 -ifft[-1]
539 -rm[-1] -translate[-1] 50%x50%x50%x0x2 -sharpen[-1] 1 -n[-1] 1,1.2 -r[-1] [-2]
540 -*[-2,-1] -cut[-1] [-2],[-2] -rm[-2] -v+
542 # B&W Stencil filter.
543 #--------------------
544 #@gmic stencilbw : (no args) : Apply B&W stencil effect on the last image.
545 stencilbw :
546 -e "Apply B&W stencil effect on the last image."
547 -v- -r[-1] 100%x100%x1x100% -t float [-1] -edges 30 -quantize[-2] 3 -blur[-2] 10
548 -sharpen[-2] 1000000 -norm[-2] -n[-2] 0,1 -*[-1,-2] -n[-1] 0,255 -v+
550 # B&W Pencil filter.
551 #-------------------
552 #@gmic pencilbw : (no args) : Apply B&W pencil effect on the last image.
553 pencilbw :
554 -e "Apply B&W pencil effect on the last image." -v- -r[-1] 100%x100%x1x100%
555 -norm[-1] -blur[-1] 0.3 -sharpen[-1] 4000 -smooth[-1] 60,0,1 -equalize[-1] 256
556 -sqrt[-1] -n[-1] 0,255 -r[-1] 100%x100%x1x3 -v+
558 # B&W dithered filter.
559 #----------------------
560 #@gmic ditheredbw : (no args) : Create dithered B&W version of the last image.
561 ditheredbw :
562 -e "Create dithered B&W version of the last image." -v- -n[-1] 0,255
563 -r[-1] 100%x100%x100%x3 -i 2x1x1x3 -f[-1] 0,255 -rgb2lut[-2] [-1],1
564 -lut2rgb[-2] [-1] -rm[-1] -v+
566 # B&W dots effect.
567 #-----------------
568 #@gmic dotsbw : (no args) : Apply B&W dots effect on the last image.
569 dotsbw :
570 -e "Apply B&W dots effect on the last image."
571 -v- -t float -norm[-1] --r[-1] 10%x10%x1x1x2 [-1]x4 -threshold[-5] 10%
572 -threshold[-4] 30% -threshold[-3] 50% -threshold[-2] 70% -threshold[-1] 90%
573 -r[-5--1] [-6],4 -translate[-5--1] -5,-5 -rm[-6] -_circle 3 -dilate[-6] [-1]
574 -rm[-1] -_circle 5 -dilate[-5] [-1] -rm[-1] -_circle 7 -dilate[-4] [-1]
575 -rm[-1] -_circle 9 -dilate[-3] [-1] -rm[-1] -_circle 11 -dilate[-2] [-1]
576 -rm[-1] -or[-5--1] -n[-1] 0,255 -r[-1] 100%x100%x1x3 -v+
578 # Andy Warhol style.
579 #-------------------
580 #@gmic warhol : 'M=3,N=M' : Create a MxN Andy Warhol effect on the last image.
581 _warhol :
582 [-1] 6x1x1x1x3 -f[-3] 0,1,2,3,4,5 -n[-1] 0.2,0 -n[-3] 0,255 -f[-2,-1] 128 -noise[-2,-1] 60,0 -a[-3--1] v
583 -cut[-1] 0,255 -ycbcr2rgb[-1] -r[-1] 256x1x1x3,3 -sqr[-1] -n[-1] 0,255 -lut2rgb[-2] [-1] -rm[-1] -mv[-1] -2
584 warhol : -int ${1=3},${2=$1}
585 -e "Create a $1x$2 Andy Warhol effect on the last image."
586 -v- -t float -norm[-1] -blur[-1] 2 -quantize[-1] 6 -n[-1] 0,255
587 -i[0] ($1) -+[0] $2 -/[0] 2 -pow[0] -1 -*[0] 100 -round[0] 1,-1 -r[-1] @0%x@0%x1x1,2
588 -f[0] $1 -*[0] $2 -repeat @0 -_warhol -done -rm[0,-1] -append_tile $1,$2 -v+
590 # Cubism.
591 #--------
592 #@gmic cubism : 'nb_iter=160,bloc_size=30,max_angle=75,opacity=0.7,smoothness=0' : Apply cubism effect on the last image.
593 _cubism :
594 1x1x1x1x2 -rand[-2] 0,@{-3,0} -rand[-1] 0,@{-3,1} -a[-2,-1] x -round[-1] 1 --+[-1] $1 --[-2] $1
595 --crop[-4] @-2,@-1,1 -blur[-1] $4 --f[-1] 1 -rm[-3] 1 -rand[-1] -$2,$2 -rotate[-3,-2] @-1,0,0 -rm[-1]
596 -image[-5] [-2],@-3,0,$3,[-1] -rm[-3--1]
598 cubism : -int ${1=160},${2=30} -float ${3=75},${4=0.7},${5=0}
599 -e "Apply cubism effect on the last image, with $1 iterations, bloc size $2, maximum angle $3, opacity $4 and smoothness $5."
600 -v- --dimensions[-1] -repeat $1 -_cubism $2,$3,$4,$5 -done -rm[-1] -v+
602 # Soft glow.
603 #-----------
604 #@gmic glow : 'amplitude=3' : Apply glow effect on the last image.
605 glow : -float ${1=3}
606 -e "Apply glow effect on the last image, with amplitude $1."
607 -v- -t float -r[-1] 100%x100%x1x3 -rgb2ycbcr[-1] -s[-1] v --blur[-3] $1 -n[-1] [-4] -+[-4,-1] -/[-3] 2
608 -a[-3--1] v -ycbcr2rgb[-1] -v+
610 # Old photo filter.
611 #------------------
612 #@gmic old_photo : (no args) : Apply old photo effect on the last image.
613 old_photo :
614 -e "Apply old photo effect on the last image."
615 -v- -noise 20 -blur 1 -sharpen 30,1 -blur 0.8 -frame_fuzzy 20,20,6,3 -damp_patch 0.7 -n 0,255 -sepia -v+
617 #-------------------------
618 #
619 # Color filters
620 #
621 #-------------------------
623 # Compute luminance.
624 #-------------------
625 #@gmic luminance : (no args) : Compute luminance of the last image.
626 luminance :
627 -e "Compute luminance of the last image."
628 -v- -n[-1] 0,255 -r[-1] 100%x100%x1x3 -rgb2ycbcr[-1] -channels[-1] 0 -v+
630 # Apply a 3x3 transformation matrix to RGB vectors.
631 #---------------------------------------------------
632 #@gmic mix_rgb : a11,a12,a13,a21,a22,a23,a31,a32,a33 : Apply 3x3 specified matrix to RGB colors.
633 mix_rgb : -float ${1=1},${2=0},${3=0},${4=0},${5=1},${6=0},${7=0},${8=0},${9=1}
634 -e "Apply matrix [ $1 $2 $3 ; $4 $5 $6 ; $7 $8 $9 ] to RGB pixels of the last image."
635 -v- -t float -r[-1] 100%x100%x1x3,0,2 -s[-1] v
636 --*[-3] $4 --*[-3] $5 -+[-1,-2] --*[-2] $6 -+[-1,-2]
637 --*[-4] $7 --*[-4] $8 -+[-1,-2] --*[-3] $9 -+[-1,-2]
638 -*[-5] $1 -*[-4] $2 -*[-3] $3 -+[-5--3]
639 -a[-3--1] v -v+
641 # Solarize.
642 #----------
643 #@gmic solarize : (no args) : Apply solarization effect on the last image.
644 solarize :
645 -e "Apply solarization effect on the last image."
646 -v- -luminance -n[-1] 0,128 -lut2rgb[-1] 1 -v+
648 # Sepia filter.
649 #--------------
650 #@gmic sepia : (no args) : Apply sepia tones filter on the last image.
651 _sepia :
652 -i 6x1x1x3 -f[-1] 0,44,115,143,196,244,0,20,84,119,184,235,0,5,44,73,144,200 -r[-1] 256x1x1x3,3
653 sepia :
654 -e "Apply sepia tones filter on the last image."
655 -v- -luminance -_sepia -lut2rgb[-2] [-1] -rm[-1] -v+
657 # Negative.
658 #----------
659 #@gmic negative : (no args) : Compute negative of last image negative.
660 negative :
661 -e "Compute negative of the last image."
662 -v- -t float -*[-1] -1 [-1] -stats[-1] -c[-1] 0,0,0,0 -r[-1] [-2] --[-1,-2] -v+
664 # Select RGB pixels in an image.
665 #--------------------------------
666 #@gmic select_rgb : 'R=0,G=0,B=0,tolerance=10' : Select RGB colored pixels in the last image.
667 select_rgb :
668 -e "Select RGB color ($(1=0),$(2=0),$(3=0)) in the last image, with tolerance $(4=30)."
669 -v- 1x1x1x3 -f[-1] $1,$2,$3 -r[-1] [-2] --[-2,-1] -norm[-1] -threshold[-1] $4 -negative -v+
671 # Fill image with RGB color.
672 #---------------------------
673 #@gmic fill_rgb : 'R=0,G=0,B=0' : Fill last image with specified RGB color.
674 fill_rgb :
675 -e "Fill last image with RGB color ($(1=0),$(2=$1),$(3=$2))."
676 -dimensions[-1] ($1^$2^$3) -r[-1] @-2 -rm[-2]
678 #-------------------------
679 #
680 # Motion related filters
681 #
682 #-------------------------
684 # Cross-correlation and normalized cross-correlation.
685 #-----------------------------------------------------
686 #@gmic cross_correlation : (no args) : Compute cross-correlation between the two last images.
687 cross_correlation :
688 -e "Compute cross-correlation between the two last images."
689 -v- -t float -norm[-2,-1] -fft[-2] -fft[-1] [-2,-1] -mul[-2] [-5] -mul[-1] [-6]
690 --[-2,-1] -*[-5,-3] -*[-3,-2] -+[-3,-2] -ifft[-2,-1] -rm[-1] -v+
692 #@gmic normalized_cross_correlation : (no args) : Compute normalized cross-correlation between the two last images.
693 normalized_cross_correlation :
694 -e "Compute normalized cross-correlation between the two last images."
695 -v- -t float -norm[-2,-1] -fft[-2] -fft[-1] [-2,-1] -mul[-2] [-5] -mul[-1] [-6]
696 --[-2,-1] -*[-5,-3] -*[-3,-2] -+[-3,-2] [-2,-1] -a[-2,-1] v -norm[-1]
697 -/[-3] [-1] -/[-2,-1] -ifft[-2,-1] -rm[-1] -v+
699 # Phase correlation.
700 #-------------------
701 #@gmic phase_correlation : (no args) : Estimate translation vector between the two last images by the phase correlation method.
702 phase_correlation :
703 -e "Compute phase correlation between the two last images."
704 -v- -normalized_cross_correlation -stats[-1] -c[-1] 0,8,0,10 -r[-1] 1,1,1,3,-1 -v+
706 # Compute a morphing sequence (between the two latest images).
707 #-------------------------------------------------------------
708 #@gmic morph : 'N=10,smoothness=0.2' : Compute morphing sequence between the two latest images.
709 morph : -int ${1=10} -float ${2=0.2}
710 -e "Compute morphing sequence with $1 frames and smoothness $2."
711 -v- -t float -r[-1] [-2],3 [-2] -displacement[-1] [-2],$2
712 -warp[-3] [-1],1,1,1,$1 -*[-1] -1 -warp[-2] [-1],1,1,1,$1 -rm[-1]
713 -a[-$1--1] z -reverse -a[-$1--1] z
714 1x1x2 -f[-1] 0,1 -r[-1] [-2],3 -*[-2] [-1] -*[-1] -1 -+[-1] 1 -*[-3,-1]
715 -+[-2,-1] -s[-1] z -reverse[-$1--1] -v+
717 # Register two latest images with a rigid or non-rigid warp.
718 #------------------------------------------------------------
719 #@gmic register : 'method=0' : Register last image with the penultimate image ('method' can be '{0=translation, 1=non-rigid warp}').
720 _register1 :
721 -e "Align last and penultimate images with non-rigid warp."
722 -v- -t float -r[-1] [-2],3 [-1] -displacement[-1] [-3],1.2 -warp[-2] [-1],1 -rm[-1] -v+
723 _register0 :
724 -e "Align last and penultimate images with translation."
725 -v- -t float -r[-1] [-2],3 [-2,-1] -blur[-2,-1] 2 -equalize[-2,-1] 256 -phase_correlation -r[-1] [-2],[-2]
726 -warp[-2] [-1],1,1,2,1 -rm[-1] -v+
727 register : -int ${1=1}
728 -if $1 -_register1 -else -_register0 -endif
730 #-------------------------
731 #
732 # Video related filters
733 #
734 #-------------------------
736 # Deinterlace frame.
737 #-------------------
738 #@gmic deinterlace : 'method=0' : Deinterlace last image by a simple algorithm ('method' can be 0=simple or 1=motion-compensated).
739 _deinterlace0 :
740 -e "Deinterlace last image with simple method."
741 -v- -t float -k[-1] [-1] -s[-1] y -a[1--1:2] y -a[2--1] y -r[-1,-2] [-3]x5 -+[-1,-2]
742 -/[-1] 2 -rm[-2] -v+
743 _deinterlace1 :
744 -e "Deinterlace last image with motion-compensated method."
745 -v- -t float -k[-1] -s[-1] y -a[0--1:2] y -a[1--1] y -r[-2] [-1],0
746 -r[-1,-2] 100%x200%x1x100%x5 [-2] -displacement[-1] [-2]x0.01
747 -warp[-3] [-1],1,1,1,2 -*[-1] -1 -warp[-2] [-1],1,1,1,2 -rm[-1] -k[-2,-4] -+[-1,-2]
748 -/[-1] 2 -v+
749 deinterlace :
750 -_deinterlace${1=0]
752 # Predator effect. (first image must be the reference background, second image is the one to process).
753 #---------------------------------------------------------------------------------------------------
754 #@gmic predator : (no args) : Apply predator effect on the last image using background as the penultimate image.
755 predator :
756 -e "Apply predator effect on the last image."
757 -v- -t float -equalize[-2--1] 256 --[-1] [-2] -sqr[-1] -cut[-1] 20%,100%
758 -blur[-1] 1 -n[-1] 0,30 -channels[-1] 0,1 -warp[-2] [-1],1,1 -rm[-1] -v+
760 #-------------------------
761 #
762 # Other various filters
763 #
764 #-------------------------
766 # Horizontal fading.
767 #-------------------
768 #@gmic fade_x : 'start=30,end=70' : Create an horizontal fading transition between the two last images ('start' and 'end' in [0..100]).
769 _fade : -float ${1=30},${2=70}
770 -t float -r[-2] [-3],5 -r[-1] [-2],3 -cut[-1] $1%,$2% -n[-1] 0,1 --*[-1] -1 -+[-1] 1 -*[-4,-1] -*[-2,-1] -+[-2,-1]
771 fade_x :
772 -e "Create ($1%,$2%) horizontal fading transition between the two last images."
773 -v- 2 -f[-1] 0,1 -_fade $1,$2 -v+
775 # Vertical fading.
776 #-----------------
777 #@gmic fade_y : 'start=30,end=70' : Create a vertical fading transition between the two last images ('start' and 'end' in [0..100]).
778 fade_y : -float ${1=30},${2=70}
779 -e "Create ($1%,$2%) vertical fading transition between the two last images."
780 -v- 1x2 -f[-1] 0,1 -_fade $1,$2 -v+
782 # Radial fading.
783 #---------------
784 #@gmic fade_radial : 'start=30,end=70' : Create radial fading transition between the two last images ('start' and 'end' in [0..100]).
785 fade_radial : -float ${1=30},${2=70}
786 -e "Create ($1%,$2%) radial fading transition between the two last images."
787 -v- 100%x100% -point 50%,50%,0,1,1 -distance[-1] 1 -_fade $1,$2 -v+
789 # Diamond fading.
790 #----------------
791 #@gmic fade_diamond : 'start=70,end=90' : Create diamond-shaped fading transition between the two last images ('start' and 'end' in [0..100]).
792 fade_diamond : -float ${1=70},${2=90}
793 -e "Create ($1%,$2%) diamond-shaped fading transition between the two last images."
794 -v- 3x3 -f[-1] 0,1,0,1,1,1,0,1,0 -_fade $1,$2 -v+
796 # Image composition : try to generate an image containing all details of an image list.
797 # Usage : gmic image1.jpg -compose_add image2.jpg -compose_add ... imageN.jpg -compose_add -compose
798 #----------------------------------------------------------------------------------------------------
799 #@gmic compose_add : (no args) : Generate composition image from the last image (to be used with '-compose').
800 compose_add :
801 -e "Generate composition image."
802 -v- [-1] -gradient_norm -blur[-1] 2 -n[-1] 1,10 -sqr[-1] -s[-2] v -*[-4] [-1]
803 -*[-3] [-1] -*[-2] [-1] -a[-4--1] v -v+
805 #@gmic compose : (no args) : Compose images of the list togethers.
806 compose :
807 -e "Compose all images of the list togethers."
808 -v- -r [0],[0],1,4,0 -r [-1],3 -+ -s[-1] v -/[-4] [-1] -/[-3] [-1] -/[-2] [-1]
809 -rm[-1] -a v -v+
811 # Multiply composition.
812 #----------------------
813 #@gmic compose_multiply : (no args) : Compose the penultimate image with the last one, using multiply composition.
814 compose_multiply :
815 -e "Compose the penultimate image with the last one, using multiply composition."
816 -v- -t float -r[-1] 100%x100%x1x[-2] -r[-1] [-2],3 -/[-1] 255 -*[-2,-1] -v+
818 # Screen composition.
819 #---------------------
820 #@gmic compose_screen : (no args) : Compose the penultimate image with the last one, using screen composition.
821 compose_screen :
822 -e "Compose the penultimate image with the last one, using screen composition."
823 -v- -t float -r[-1] 100%x100%x1x[-2] -r[-1] [-2],3 -/[-1] 255
824 -*[-1] 1 -+[-1] 1 -*[-2] -1 -+[-2] 255 -*[-2,-1] -*[-1] -1 -+[-1] 255 -v+
826 # Overlay composition.
827 #---------------------
828 #@gmic compose_overlay : (no args) : Compose the penultimate image with the last one, using overlay composition.
829 compose_overlay :
830 -e "Compose the penultimate image with the last one, using overlay composition."
831 -v- -t float -r[-1] 100%x100%x1x[-2] -r[-1] [-2],3 -/[-1] 255
832 --threshold[-1] 0.5 --*[-3] 4 -+[-1] 510 -*[-1] [-3] --[-1] 255
833 -*[-4] 2 -+[-1] [-4] -*[-4,-3] -*[-3,-2] -+[-2,-1] -v+
835 # Print the factorial of an integer.
836 #-----------------------------------
837 #@gmic factorial : 'N' : Print the factorial of the integer 'N'.
838 factorial : -int $1
839 -v- ($1) -+[-1] 1 -if @-1 (1) (1) -repeat $1 -*[-1] @-2 -+[-2] 1 -done -v+ -e "Factorial($1) = @-1" -v- -rm[-3--1]
840 -else -echo "Factorial($1) is undefined." -q -endif -v+
842 # This is a sucking easter-egg ! (R-Rated).
843 #------------------------------------------
844 dick3d :
845 -e ""
846 -e "!!********************************************************!!"
847 -e "!! Congratulations ! You have found the hidden Easter-egg !!"
848 -e "!!********************************************************!!"
849 -e ""
850 -v- -rm -t float 2 1x2 1x1x2 -f -1,1 -r 100x100x100x1x3 -sqr -+ -* -8 -exp
851 [0]x2 -translate[-1] 20 -translate[-2] -20 -+[-1,-2] -translate[-1] 0,-20
852 -r[-2] 100x220x100x1x3 -r[-2] 100x100x100x3,0,0,1 -translate[-2] 0,10 -+
853 -isovalue3d 0.5 -rd3d 4 -d3d -v+
855 # Create 3D centered unit mapped cube from an image.
856 #---------------------------------------------------
857 #@gmic imagecube3d : 'resolution' : Create a 3D mapped cube from the last image.
858 imagecube3d : -int ${1=128}
859 -e "Create 3D mapped cube of size $1x$1x$1 from last image."
860 -v- -r[-1] $1,$1,1,-100,2 -mirror[-1] x -elevation3d[-1] 0 -c3d[-1] -n3d[-1] -+3d[-1] 0,0,0.5 --rot3d[-1] 0,1,0,180
861 -+3d[-2,-1] --rot3d[-1] 0,1,0,90 --rot3d[-2] 1,0,0,90 -+3d[-3--1] -v+
863 # Local Variables:
864 # mode: sh
865 # End:
866 #
867 # (End of G'MIC macro file)