PTdecode/CImg-1.3.0/examples/gmic_def.raw

changeset 5
1204ebf9340d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/PTdecode/CImg-1.3.0/examples/gmic_def.raw	Mon Aug 03 14:09:20 2009 +0100
     1.3 @@ -0,0 +1,867 @@
     1.4 +#
     1.5 +#  File        : gmic_def.raw
     1.6 +#                ( G'MIC default macro file )
     1.7 +#
     1.8 +#  Description : Define additional commands for G'MIC (GREYC's Magic Image Converter).
     1.9 +#                ( http://gmic.sourceforge.net )
    1.10 +#                This file is also a part of the CImg Library project.
    1.11 +#                ( http://cimg.sourceforge.net )
    1.12 +#
    1.13 +#  Usage       : gmic [-m gmic_def.raw] (...)
    1.14 +#
    1.15 +#  Note        : This file is here for illustration purposes, since commands defined in
    1.16 +#                the default macro file are already present by default in G'MIC.
    1.17 +#                Then, explicit inclusion of this file (using the '-m' option) if
    1.18 +#                useless.
    1.19 +#
    1.20 +#  Copyright   : David Tschumperle
    1.21 +#                ( http://www.greyc.ensicaen.fr/~dtschump/ )
    1.22 +#
    1.23 +#  License     : CeCILL v2.0
    1.24 +#                ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
    1.25 +#
    1.26 +#  This software is governed by the CeCILL  license under French law and
    1.27 +#  abiding by the rules of distribution of free software.  You can  use,
    1.28 +#  modify and/ or redistribute the software under the terms of the CeCILL
    1.29 +#  license as circulated by CEA, CNRS and INRIA at the following URL
    1.30 +#  "http://www.cecill.info".
    1.31 +#
    1.32 +#  As a counterpart to the access to the source code and  rights to copy,
    1.33 +#  modify and redistribute granted by the license, users are provided only
    1.34 +#  with a limited warranty  and the software's author,  the holder of the
    1.35 +#  economic rights,  and the successive licensors  have only  limited
    1.36 +#  liability.
    1.37 +#
    1.38 +#  In this respect, the user's attention is drawn to the risks associated
    1.39 +#  with loading,  using,  modifying and/or developing or reproducing the
    1.40 +#  software by the user in light of its specific status of free software,
    1.41 +#  that may mean  that it is complicated to manipulate,  and  that  also
    1.42 +#  therefore means  that it is reserved for developers  and  experienced
    1.43 +#  professionals having in-depth computer knowledge. Users are therefore
    1.44 +#  encouraged to load and test the software's suitability as regards their
    1.45 +#  requirements in conditions enabling the security of their systems and/or
    1.46 +#  data to be ensured and,  more generally, to use and operate it in the
    1.47 +#  same conditions as regards security.
    1.48 +#
    1.49 +#  The fact that you are presently reading this means that you have had
    1.50 +#  knowledge of the CeCILL license and that you accept its terms.
    1.51 +#
    1.52 +
    1.53 +#----------------------------------------
    1.54 +#
    1.55 +# Get and display image characteristics
    1.56 +#
    1.57 +#----------------------------------------
    1.58 +
    1.59 +# Compute image gradient norm.
    1.60 +#-----------------------------
    1.61 +#@gmic gradient_norm : (no args) : Compute gradient norm of the last image.
    1.62 +gradient_norm :
    1.63 +  -e "Compute gradient norm of the last image."
    1.64 +  -v- -t float -gradient[-1] xyz -a[-3--1] v -norm[-1] -sqrt[-1] -v+
    1.65 +
    1.66 +# Compute image gradient orientation in 'N'-D.
    1.67 +#---------------------------------------------
    1.68 +#@gmic gradient_orientation : N=3 : Compute N-D gradient orientation of the last image.
    1.69 +_gradient_orientation3 :
    1.70 +   -gradient[-1] xyz --sqr[-3--1] -+[-3--1] -+[-1] 1e-8 -sqrt[-1] -/[-4,-3] [-1] -/[-2,-1]
    1.71 +_gradient_orientation2 :
    1.72 +   -gradient[-1] xy --sqr[-2,-1] -+[-2,-1] -+[-1] 1e-8 -sqrt[-1] -/[-3] [-1] -/[-2,-1]
    1.73 +_gradient_orientation1 :
    1.74 +   -gradient[-1] x --abs[-1] -+[-1] 1e-8 -/[-2,-1]
    1.75 +gradient_orientation : -int ${1=3}
    1.76 +  -v- -if $1 (4) --[-1] $1 -if @-1 -rm[-1]
    1.77 +  -v+ -e "Compute $1-D gradient orientation of the last image." -v-
    1.78 +  -t float -_gradient_orientation$1 -else -v+ -e "Invalid argument '$1', should be '{1,2,3}'." -q
    1.79 +  -endif -else -v+ -e "Invalid argument '$1', should be '{1,2,3}'." -q
    1.80 +  -endif -v+
    1.81 +
    1.82 +# Compute image laplacian.
    1.83 +#-------------------------
    1.84 +#@gmic laplacian : (no args) : Compute Laplacian of the last image.
    1.85 +laplacian :
    1.86 +  -e "Compute image laplacian of the last image."
    1.87 +  -v- -t float -hessian[-1] xxyyzz -+[-3--1] -v+
    1.88 +
    1.89 +# Compute oriented second derivative in the gradient direction.
    1.90 +#--------------------------------------------------------------
    1.91 +#@gmic gradient_2derivative : (no args) : Compute gradient-directed 2nd derivative of the last image.
    1.92 +gradient_2derivative :
    1.93 +  -e "Compute gradient-directed 2nd derivative of the last image."
    1.94 +  -v- -t float --gradient[-1] xyz -hessian[-4] xxxyxzyyyzzz
    1.95 +  --sqr[-3] -*[-10,-1] --sqr[-2] -*[-7,-1] --sqr[-1] -*[-5,-1]
    1.96 +  -*[-8,-7,-5] 2 -*[-8] [-3] -*[-8] [-2] -*[-7] [-3] -*[-7] [-1] -*[-5] [-2] -*[-5] [-1]
    1.97 +  -+[-9--4] -sqr[-3--1] -+[-3--1] -+[-1] 1e-8 -/[-2,-1] -v+
    1.98 +
    1.99 +# Difference of Gaussians.
   1.100 +#-------------------------
   1.101 +#@gmic dog : 'sigma1=2','sigma2=3' : Compute edges in the last image by using difference of gaussian-filtered images.
   1.102 +dog : -float ${1=2},${2=3}
   1.103 +  -e "Compute edges in the last image by difference of gaussian-filtered images, with standard deviations $1 and $2."
   1.104 +  -v- -t float --blur[-1] $1 -blur[-2] $2 --[-1,-2] -norm[-1] -v+
   1.105 +
   1.106 +# Estimate isophote curvatures.
   1.107 +#------------------------------
   1.108 +#@gmic curvature : (no args) : Estimate isophote curvatures of the last image.
   1.109 +curvature :
   1.110 +  -e "Estimate isophote curvatures of the last image."
   1.111 +  -v- [-1]x2 -laplacian -mv[-1] -2 -gradient_2derivative --[-2,-1]
   1.112 +  -mv[-1] -2 -gradient_norm -+[-1] 1e-8 -/[-2,-1] -v+
   1.113 +
   1.114 +# Complex<->polar transform (the two last images give the real and imaginary parts).
   1.115 +#-----------------------------------------------------------------------------------
   1.116 +#@gmic complex2polar : (no args) : Compute complex->polar transform (two last images are real and imaginary parts).
   1.117 +complex2polar :
   1.118 +  -e "Compute complex to polar transform."
   1.119 +  -v- -t float -+[-2] 1e-8 --/[-1] [-2] -atan[-1] -sqr[-3,-2] -+[-3,-2] -sqrt[-2] -v+
   1.120 +
   1.121 +#@gmic polar2complex : (no args) : Compute polar->complex transform (two last images are real and imaginary parts).
   1.122 +polar2complex :
   1.123 +  -e "Compute polar to complex transform."
   1.124 +  -v- -t float [-1] -cos[-2] -sin[-1] -*[-1] [-3] -*[-3,-2] --[-2] 1e-8 -v+
   1.125 +
   1.126 +# Fourier transform viewer with centered log-module and centered argument.
   1.127 +#-------------------------------------------------------------------------
   1.128 +#@gmic display_fft : (no args) : Display Fourier transform of the last image with centered log-module and argument (eq. to '-dfft').
   1.129 +display_fft :
   1.130 +  -e "Display Fourier transform of the last image."
   1.131 +  -v- -t float -fft[-1] -complex2polar -translate[-2,-1] 50%,50%,50%,0,2 -log[-2] -n 0,255 -v+
   1.132 +dfft :
   1.133 +  -display_fft
   1.134 +
   1.135 +# Render a RGBA image over a user-defined background.
   1.136 +#----------------------------------------------------
   1.137 +#@gmic compose_rgba : (no args) : Render a RGBA image (last image) over a RGB background (penultimate image).
   1.138 +compose_rgba :
   1.139 +  -e "Compose RGBA image with RGB background."
   1.140 +  -v- --[-1] 255 -r[-1] 100%x100%x1x4x0 -+[-1] 255 -r[-1] [-2],[-2],[-2],4,0
   1.141 +  -s[-1] v -a[-4--2] v -/[-1] 255 [-1] -negative -r[-4--1] 100%x100%x1x3
   1.142 +  -*[-4,-1] -*[-2,-1] -+[-2,-1] -v+
   1.143 +
   1.144 +# Render a RGBA image over a synthetic checkerboard background.
   1.145 +#--------------------------------------------------------------
   1.146 +#@gmic display_rgba : (no args) : Render a RGBA image (last image) over a synthetic background (eq. to '-drgba').
   1.147 +display_rgba :
   1.148 +  -e "Render RGBA image over synthetic background."
   1.149 +  -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+
   1.150 +drgba :
   1.151 +  -display_rgba
   1.152 +
   1.153 +#-----------------------------
   1.154 +#
   1.155 +# Geometric filters
   1.156 +#
   1.157 +#-----------------------------
   1.158 +
   1.159 +# Image array.
   1.160 +#-------------
   1.161 +#@gmic array : 'M=3,N=M' : Create a MxN array from the last image.
   1.162 +array : -int ${1=3},${2=$1}
   1.163 +  -e "Create a $1x$2 array from last image."
   1.164 +  -v- [-1]x$1 -rm[-1] -a[-$1--1] x [-1]x$2 -rm[-1] -a[-$2--1] y -v+
   1.165 +
   1.166 +# Tiled array.
   1.167 +#-------------
   1.168 +#@gmic array_tile : 'M=3,N=M' : Create a MxN fade-tiled array from the last image.
   1.169 +array_tile : -int ${1=3},${2=$1}
   1.170 +  -e "Create a $1x$2 fade-tiled array from the last image."
   1.171 +  -v- --translate[-1] 50%x50%x1x1,2 -mv[-1] -2 -fade_diamond 80,90 -array $1,$2 -v+
   1.172 +
   1.173 +# Mirror-tiled image.
   1.174 +#--------------------
   1.175 +#@gmic mirror_tile : 'N=2' : Create a NxN mirror-tiled version of the last image.
   1.176 +_mirror_tile :
   1.177 +  [-1]x3 -mirror[-3,-1] x -mirror[-2,-1] y -a[-4,-3] x -a[-2,-1] x -a[-2,-1] y
   1.178 +mirror_tile : -int ${1=2}
   1.179 +  -e "Create a $1x mirror-tiled version of the last image."
   1.180 +  -v- -i[0] ($1) --[0] 1 -repeat @0 -_mirror_tile -done -rm[0] -v+
   1.181 +
   1.182 +# Taquin puzzles.
   1.183 +#----------------
   1.184 +#@gmic taquin : 'M=4,N=M' : Create a MxN taquin puzzle from the last image.
   1.185 +_taquin :
   1.186 +  -i @0 -rand[-1] @0,1 -*[-1] -1 -round[-1] 1 --[-1] 1 -reverse[@-1] -rm[-1]
   1.187 +taquin : -int ${1=4},${2=$1}
   1.188 + -e "Create $1x$2 taquin puzzle from the last image."
   1.189 + -v- -i[0] ($1) -*[0] $2 -split_tile $1,$2 -repeat 10 -_taquin -done -rm[0] -append_tile $1,$2 -v+
   1.190 +
   1.191 +# Image grids.
   1.192 +#-------------
   1.193 +#@gmic grid : 'M=10,N=M' : Create a MxN grid version of the last image.
   1.194 +grid : -int ${1=10},${2=$1}
   1.195 +  -e "Create $1x$2 grid version of the last image."
   1.196 +  -v- -i[-2] $1x$2 -f[-2] 1 --translate[-2] -1,-1 --[-3,-1] -*[-2] -1
   1.197 +  -+[-2] 1 --dimensions[-1] -s[-1] y -/[-4] $1 -/[-3] $2 (2) -a[-5--1] y
   1.198 +  -round[-1] 1,-1 -r[-2] @-1 -s[-1] y -rm[-1] -*[-4] $1 -*[-3] $2 -a[-4--1] y -r[-2] @-1
   1.199 +  (0;2) -a[-2,-1] y -r[-3] @-1 -rm[-1] -r[-1] [-2] -*[-2,-1] -v+
   1.200 +
   1.201 +# Insert colored frames around image.
   1.202 +#------------------------------------
   1.203 +#@gmic frame : 'W=20,H=W,R=255,G=255,B=255' : Insert a WxH RGB-colored frame around the last image.
   1.204 +_framex :
   1.205 +  -i 1,1,1,3 -f[-1] $2,$3,$4 -r[-1] $1,[-2],[-2],[-2],1 -i[-3] [-1] -a[-3--1] x
   1.206 +_framey :
   1.207 +  -i 1,1,1,3 -f[-1] $2,$3,$4 -r[-1] [-2],$1,[-2],[-2],1 -i[-3] [-1] -a[-3--1] y
   1.208 +frame : -int ${1=20},${2=$1} -float ${3=255},${4=$3},${5=$4}
   1.209 +  -e "Insert a $1x$2 frame with RGB color ($3,$4,$5) in the last image."
   1.210 +  -v- -_framex $1,$3,$4,$5 -_framey $2,$3,$4,$5 -v+
   1.211 +
   1.212 +# Draw a colored fuzzy frame around image.
   1.213 +#-----------------------------------------
   1.214 +#@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.
   1.215 +frame_fuzzy : -int ${1=20},${2=$1} -float ${3=5},${4=1},${5=255},${6=$5},${7=$6}
   1.216 +  -e "Draw a $1x$2 fuzzy frame with RGB color ($5,$6,$7), fuzzyness $3 and smoothness $4 in the last image."
   1.217 +  -v- -i[0] ($1;$2) -*[0] 2 1x1x1x3 -f[-1] $5,$6,$7 -r[-1] [-2] 100%x100%
   1.218 +  -polygon[-1] 4,0,0,100%,0,100%,@{0,1},0,@{0,1},1,1
   1.219 +  -polygon[-1] 4,0,0,@{0,0},0,@{0,0},100%,0,100%,1,1
   1.220 +  -rm[0] -translate[-1] $1,$2,0,0,2 -spread $3 -blur[-1] $4 -_fade 50,80 -v+
   1.221 +
   1.222 +# Polaroid effect.
   1.223 +#-----------------
   1.224 +#@gmic polaroid : 'W1=30,W2=120,W3=40' : Create polaroid from last image, with specified border sizes.
   1.225 +polaroid : -int ${1=30},${2=120},${3=40}
   1.226 +  -e "Create polaroid effect from the last image with borders $1, $2 and $3."
   1.227 +  -v- -frame $1,$1,255,255,255 [-1],$2,1,3 -f[-1] 255 -a[-2,-1] y
   1.228 +  --dimensions[-1] -+[-1] $3 -+[-1] $3 --f[-2] -1 -r[-1] @{-2,0-1},1,3,0,0,1 -rm[-2]
   1.229 +  -blur[-1] 5 -r[-2] [-1],0,0,1 -n[-1] 0,180 -or[-2,-1] -v+
   1.230 +
   1.231 +# Drop shadow.
   1.232 +#-------------
   1.233 +#@gmic drop_shadow : '(no args) : Add a drop shadow behind the last image.
   1.234 +drop_shadow :
   1.235 +  -e "Add a drop shadow behind the last image."
   1.236 +  -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
   1.237 +  -*[-2,-1] -n[-1] 0,255 -+[-2,-1] -v+
   1.238 +
   1.239 +# Split into tiles.
   1.240 +#------------------
   1.241 +#@gmic split_tile : 'M=8,N=M' : Split last image into MxN regular tiles.
   1.242 +split_tile : -int ${1=8},${2=$1}
   1.243 +  -e "Decompose last image into $1x$2 regular tiles."
   1.244 +  -v- -i[0] ($1) -*[0] $2 -s[-1] x,$1 -s[-$1--1] y,$2 -r[-@0--1] [-@0],0 -rm[0] -v+
   1.245 +
   1.246 +# Append tiles.
   1.247 +#--------------
   1.248 +#@gmic append_tile : 'M=8,N=M' : Append last MxN regular tiles together.
   1.249 +append_tile : -int ${1=8},${2=$1}
   1.250 +  -e "Append last $1x$2 regular tiles together."
   1.251 +  -v- -i[0] ($1) -*[0] $2 -a[-@0--1] y -s[-1] y,$1 -a[-$1--1] x -rm[0] -v+
   1.252 +
   1.253 +# Rotate tiles.
   1.254 +#---------------
   1.255 +#@gmic rotate_tile : 'angle=5,M=8,N=M' : Apply MxN tiled-rotation effect on the last image.
   1.256 +rotate_tile : -float ${1=5} -int ${2=8},${3=$2}
   1.257 +  -e "Apply $2x$3 tiled-rotation effect on the last image, with angle $1."
   1.258 +  -v- -i[0] ($2) -*[0] $3 -split_tile $2,$3 -rotate[-@0--1] $1 -append_tile $2,$3 -v+
   1.259 +
   1.260 +# Tiled shift.
   1.261 +#-------------
   1.262 +#@gmic shift_tile : 'amplitude=20,M=8,N=M' : Apply MxN tiled-shift effect on the last image.
   1.263 +shift_tile : -float ${1=20} -int ${2=8},${3=8}
   1.264 +  -e "Apply $2x$3 tiled-shift effect on the last image, with amplitude $1."
   1.265 +  -v- -t float $2x$3x1x2 -noise[-1] $1 -r[-1] [-2],[-2],1,2 -warp[-2] [-1],1,1,0 -rm[-1] -v+
   1.266 +
   1.267 +#-----------------------------
   1.268 +#
   1.269 +# Deformation filters
   1.270 +#
   1.271 +#-----------------------------
   1.272 +
   1.273 +# Spread pixel values.
   1.274 +#---------------------
   1.275 +#@gmic spread : 'dx=3,dy=dx,dz=0' : Spread last image pixel values randomly along x,y and z.
   1.276 +spread : -float ${1=3},${2=$1},${3=0}
   1.277 +  -e "Spread pixel values of the last image with amplitudes ($1,$2,$3))."
   1.278 +  -v- -t float 100%x100%x100%x1x3 -noise[-3] $1,0 -noise[-2] $2,0
   1.279 +  -noise[-1] $3,0 -a[-3--1] v -warp[-2] [-1],1 -rm[-1] -v+
   1.280 +
   1.281 +# Water effect.
   1.282 +#--------------
   1.283 +#@gmic water : 'amplitude=30,smoothness=1.5' : Apply water effect on the last image.
   1.284 +water : -float ${1=30},${2=1.5}
   1.285 +  -e "Apply water effect on the last image, with amplitude $1 and smoothness $2."
   1.286 +  -v- -t float 25%x25%x25%x1 -noise[-1] $1 -gradient[-1] xyz -+[-1,-2,-3]
   1.287 +  -blur[-1] $2 -*[-1] 2 -warp[-2] [-1],1 -rm[-1] -v+
   1.288 +
   1.289 +# Wave effect.
   1.290 +#-------------
   1.291 +#@gmic wave : 'amplitude=4,frequency=0.4' : Apply wave effect on the last image.
   1.292 +wave : -float ${1=4},${2=0.4}
   1.293 +  -e "Apply wave effect on the last image, with amplitude $1 and frequency $2."
   1.294 +  -v- -t float (1) -r[-1] [-2],[-2],1,1,0,0,1 -distance[-1] 1
   1.295 +  -*[-1] $2 [-1] -cos[-2] -sin[-1] -a[-2,-1] v -*[-1] $1
   1.296 +  -warp[-2] [-1],1 -rm[-1] -v+
   1.297 +
   1.298 +# Linear blur.
   1.299 +#-------------
   1.300 +#@gmic blur_linear : 'amplitude=10,vx=1,vy=0' : Apply oriented linear blur on the last image.
   1.301 +_blur_linear :
   1.302 +  --warp[-2] [-1],1,1,1 -*[-2] -1 -warp[-3] [-2],1,1,1 -+[-3,-1] -/[-2] 2 -*[-1] -1
   1.303 +blur_linear : -int ${1=10} -float ${2=1},${3=0}
   1.304 +  -e "Apply linear blur on the last image, with amplitude $1 and orientation ($2,$3)."
   1.305 +  -v- -t float 1x1x1x2 -f[-1] $2,$3 -r[-1] [-2],[-2],1,2 -repeat $1 -_blur_linear -done -rm[-1] -v+
   1.306 +
   1.307 +# Radial blur.
   1.308 +#-------------
   1.309 +#@gmic blur_radial : 'amplitude=10,angle=0.5' : Apply radial blur on the last image.
   1.310 +_blur_radial :
   1.311 +  --rotate[-1] @-2,-2,0 -*[-3] -1 -rotate[-2] @-3,-2,0 -*[-3] -1 -+[-2,-1] -/[-1] 2
   1.312 +blur_radial : -int ${1=10} -float ${2=0.5}
   1.313 +  -e "Apply radial blur on the last image, with amplitude $1 and angle $2."
   1.314 +  -v- -t float [-1] -i[-2] ($2) -repeat $1 -_blur_radial -+[-2] $2 -done -v+
   1.315 +
   1.316 +# Zoom blur.
   1.317 +#-----------
   1.318 +#@gmic blur_zoom : 'amplitude=5,zoom_step=1.5' : Apply radial blur on the last image.
   1.319 +_blur_zoom :
   1.320 +  --r[-1] @0%x@0%x@0%x100%,2 -r[-1] [-2],0,1,1 -+[-2,-1] -/[-1] 2
   1.321 +blur_zoom : -int ${1=5} -float ${2=1.5}
   1.322 +  -e "Apply zoom blur on the last image, with amplitude $1 and step $2."
   1.323 +  -v- -t float -i[0] ($2) -+[0] 100 -repeat $1 -_blur_zoom -done -rm[0] -v+
   1.324 +
   1.325 +# Generic macro for applying a PDE flow.
   1.326 +#---------------------------------------
   1.327 +pde_flow :
   1.328 +  -v- -t float -repeat $2 -if $1 [-1] -endif
   1.329 +  $4 ${5*} ($3) --stats[-2] -r[-1] 1x2x1x1,0 -abs[-1] -stats[-1] -i (@{-1,1}) -rm[-2]
   1.330 +  -+[-1] 0.1 -/[-2,-1] -*[-2] @-1 -rm[-1] -+[-2,-1] -done -v+
   1.331 +
   1.332 +# Mean-curvature flow.
   1.333 +#---------------------
   1.334 +#@gmic meancurvature_flow : 'nb_iter=5, time_step=30, seq=0' : Apply iterations of the mean curvature flow on the last image.
   1.335 +_meancurvature_flow :
   1.336 +  [-1]x2 -laplacian -mv[-1] -2 -gradient_2derivative --[-2,-1]
   1.337 +meancurvature_flow : -int ${1=5},${3=0} -float ${2=30}
   1.338 +  -e "Apply $1 iterations of the mean curvature flow, with time step $2."
   1.339 +  -pde_flow $3,$1,$2,-_meancurvature_flow
   1.340 +
   1.341 +# Total variation flow.
   1.342 +#---------------------
   1.343 +#@gmic tv_flow : 'nb_iter=5, time_step=20, seq=0' : Apply iterations of the total variation flow on the last image.
   1.344 +_tv_flow :
   1.345 +  [-1]x3 -laplacian -mv[-1] -3 -gradient_2derivative --[-3,-1] -gradient_norm -+[-1] 0.5 -r[-1] [-2] -/[-2,-1]
   1.346 +tv_flow : -int ${1=5},${3=0} -float ${2=20}
   1.347 +  -e "Apply $1 iterations of the total variation flow, with time step $2."
   1.348 +  -pde_flow $3,$1,$2,-_tv_flow
   1.349 +
   1.350 +# Hurl noise.
   1.351 +#------------
   1.352 +#@gmic noise_hurl : 'amplitude' : Add hurl noise to the last image.
   1.353 +noise_hurl : -float ${1=10}
   1.354 +  -e "Add hurl noise of amplitude $1% on the last image."
   1.355 +  -v- --stats --f[-2] 0 -noise[-1] 10 -n[-1] @{-2,0,1} -rm[-2] 100%x100% -f[-1] -2
   1.356 +  -noise[-1] $1,2 -threshold[-1] 0 -r[-1] [-2]
   1.357 +  -*[-2] [-1] -*[-1] -1 -+[-1] 1 -*[-3,-1] -+[-2,-1] -v+
   1.358 +
   1.359 +# Pixelize.
   1.360 +#----------
   1.361 +#@gmic pixelize : 'sx=30,sy=sx' : Pixelize the last image with specified scales ('sx' and 'sy' in 0..100).
   1.362 +pixelize : -float ${1=20},${2=$1}
   1.363 +  -e "Pixelize last image with scales ($1%,$2%)."
   1.364 +  -v- --dimensions[-1] -r[-2] $1%x$2%x1x3,2 -r[-2] @-1 -rm[-1] -v+
   1.365 +
   1.366 +# Deforming filter.
   1.367 +#------------------
   1.368 +#@gmic deform : 'amplitude=10' : Apply random smooth deformation on the last image.
   1.369 +deform : -float ${1=10}
   1.370 +  -e "Apply random smooth deformation on the last image, with amplitude $1."
   1.371 +  -v- -t float 2%x2%x1x2 -noise[-1] $1 -r[-1] [-2],[-2],1,2,5
   1.372 +  -warp[-2] [-1],1,1,1 -rm[-1] -v+
   1.373 +
   1.374 +# Puzzle filter.
   1.375 +#---------------
   1.376 +#@gmic puzzle : (no args) : Apply puzzle effect on the last image.
   1.377 +puzzle :
   1.378 +  -e "Apply puzzle effect on the last image."
   1.379 +  -v- -t float [-1] -r[-1] 5%x5%x100%x100%x2 -noise[-1] 0.1 -r[-1] [-2] -rm[-2]
   1.380 +  [-1]x2 -translate[-1] 1,1 --[-2,-1] -norm[-1] -threshold[-1] 0.01 -*[-1] -1
   1.381 +  -+[-1] 1 -r[-1] [-2] -*[-1,-2] 10%x10%x10%x2 -noise[-1] 5,1
   1.382 +  -r[-1] [-2],[-2],1,2,5 -warp[-2] [-1],1,1,1 -rm[-1] -v+
   1.383 +
   1.384 +# Fish-eye.
   1.385 +#----------
   1.386 +#@gmic fish_eye : 'amplitude=250' : Apply Fish-eye effect on the last image.
   1.387 +fish_eye : -float ${1=250}
   1.388 +  -e "Apply Fish-eye effect on the last image, with amplitude $1."
   1.389 +  -v- -t float 2x2x1x2 -f[-1] -1,1,-1,1,-1,-1,1,1 -r[-1] [-2],[-2],1,2,3 [-1]
   1.390 +  -norm[-2] -n[-2] 0,1 -cut[-2] 0,0.7 --[-2] 0.7 -*[-2] -$1 -r[-2] [-1]
   1.391 +  -*[-2,-1] -warp[-2] [-1],1,1,1 -rm[-1] -v+
   1.392 +
   1.393 +#-----------------------------
   1.394 +#
   1.395 +# Artistic filters
   1.396 +#
   1.397 +#-----------------------------
   1.398 +
   1.399 +# Add strip shades along x or y.
   1.400 +#-------------------------------
   1.401 +#@gmic shade_stripes : 'frequency=5, direction=1' : Add horizontal or vertical shaded stripes on the last image.
   1.402 +_shade_stripes0 :
   1.403 +  -v+ -e "Add horizontal shaded stripes on the last image, with frequency $1." -v- 1x100%
   1.404 +_shade_stripes1 :
   1.405 +  -v+ -e "Add vertical shaded stripes on the last image, with frequency $1." -v- 100%
   1.406 +shade_stripes : -float ${1=5} -int ${2=1}
   1.407 +  -v- -t float -n[-1] 0,255 -_shade_stripes$2 $1 -noise[-1] $1,2 -distance[-1] 1
   1.408 +  -r[-1] [-2] -n[-1] 0.3,1.5 -*[-1,-2] -cut[-1] 0,255 -v+
   1.409 +
   1.410 +# Add old-movie stripes.
   1.411 +#-----------------------
   1.412 +#@gmic stripesy : 'frequency=10' : Add vertical stripes on the last image.
   1.413 +stripesy : -float ${1=10}
   1.414 +  -e "Add vertical stripes on the last image, with frequency $1."
   1.415 +  -v- -t float -n[-1] 0,255 100% -noise[-1] $1,2 -*[-1] 255 -r[-1] [-2]
   1.416 +  -*[-1] 0.15 -+[-1,-2] -cut[-1] 0,255 -v+
   1.417 +
   1.418 +# Tetris effect.
   1.419 +#---------------
   1.420 +#@gmic tetris : 'scale=10' : Apply tetris effect of given size on the last image.
   1.421 +tetris : -float ${1=10}
   1.422 +  -e "Apply tetris effect on the last image, with scale $1."
   1.423 +  -v- -t float [-1] -r[-1] $1%x$1%x$1%x3x2 -n[-1] 0,255 -quantize[-1] 10
   1.424 +  -r[-1] [-2] -rm[-2] -blur[-1] 2 -sharpen[-1] 300,1 -v+
   1.425 +
   1.426 +# Damp patch effect.
   1.427 +#-------------------
   1.428 +#@gmic damp_patch : 'opacity=0.7' : Apply damp patch effect on the last image.
   1.429 +damp_patch : -float ${1=0.7}
   1.430 +  -e "Apply damp patch effect on the last image, with opacity $1."
   1.431 +  -v- -t float 100%x100% -f[-1] 1 -translate[-1] 2,2 -translate[-1] -1,-1
   1.432 +  -plasma[-1] 3,0.3 -abs[-1] -blur[-1] 1 -cut[-1] 3%,15% -r[-1] [-2]
   1.433 +  -n[-1] $1,1 -*[-1,-2] -v+
   1.434 +
   1.435 +# Light patch effect.
   1.436 +#--------------------
   1.437 +#@gmic light_patch : 'darkness=0.9,lightness=1.7' : Apply light patch effect on the last image.
   1.438 +light_patch : -float ${1=0.9},${2=1.7}
   1.439 +  -e "Apply light patch effect on the last image, with darkness $1 and lightness $2."
   1.440 +  -v- -t float -n[-1] 0,255 2%x2% -noise[-1] 40 -r[-1] [-2],5 -cut[-1] 0,255
   1.441 +  -n[-1] $1,$2 -*[-2,-1] -cut[-1] 0,255 -v+
   1.442 +
   1.443 +# Mosaic pattern.
   1.444 +#----------------
   1.445 +#@gmic mosaic : 'density=0.2' : Add mosaic pattern to the last image.
   1.446 +mosaic : -float ${1=0.2}
   1.447 +  -e "Add mosaic pattern on the last image, with density $1."
   1.448 +  -v- -t float 100%x100%x1x1 -noise[-1] $1,2 -distance[-1] 1
   1.449 +  -sharpen[-1] 10000 -*[-1] -1 -blur[-1] 0.5 -n[-1] 0.3,1 -r[-1] [-2] -*[-2,-1] -v+
   1.450 +
   1.451 +# Sponge filter.
   1.452 +#---------------
   1.453 +#@gmic sponge : 'size=13' : Apply sponge filter on the last image with specified brush size.
   1.454 +_circle :
   1.455 +  -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
   1.456 +sponge : -int ${1=13}
   1.457 +  -e "Apply sponge filter on the last image, with brush size $1."
   1.458 +  -v- 100%x100%x1x1 -noise[-1] 20,2 -r[-1] [-2] -n[-1] 0,1 -*[-1,-2]
   1.459 +  -_circle $1 -dilate[-2] [-1] -rm[-1] -v+
   1.460 +
   1.461 +# Heart filter.
   1.462 +#--------------
   1.463 +#@gmic hearts : (no args) : Apply heart filter on the last image.
   1.464 +_heart9x7 :
   1.465 +  -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
   1.466 +hearts :
   1.467 +  -e "Apply heart filter on the last image."
   1.468 +  -v- 100%x100%x1 -noise[-1] 10,2 -r[-1] [-2] -n[-1] 0,1 -*[-1,-2] -_heart9x7
   1.469 +  -mirror[-1] y -dilate[-2] [-1] -rm[-1] -v+
   1.470 +
   1.471 +# Color ellipses.
   1.472 +#----------------
   1.473 +#@gmic color_ellipses : 'opacity=0.07' : Add random colored ellipses on the last image.
   1.474 +_color_ellipses :
   1.475 +  -i 10 -f[-1] @{-2,0-9} -ellipse[-3] @-1 -rm[-1] -translate[-1] 0,1
   1.476 +color_ellipses : -float ${1=0.07}
   1.477 +  -e "Add random colored ellipses to the last image, with opacity $1."
   1.478 +  -v- --dimensions[-1] -r[-1] 2x2x1x1x0 -mirror[-1] x 1x400 -rand[-1] @{-2,0,1} --rand[-1] @{-2,2,3}
   1.479 +  -rm[-3] 2x[-1] --dimensions[-4] -r[-1] 2x2x1x1x0 -s[-1] y
   1.480 +  -+[-2,-1] -mirror[-1] x -rand[-2] @{-1,0,1} -rm[-1] -/[-1] 10 --rand[-1] -1,1
   1.481 +  1x[-1] -f[-1] $1 3x[-1] -rand[-1] 10,255 -a[-6--1] x -repeat 400 -_color_ellipses -done -rm[-1] -v+
   1.482 +
   1.483 +# Whirls texture.
   1.484 +#----------------
   1.485 +#@gmic whirls : (no args) : Add random whirl texture on the last image.
   1.486 +whirls :
   1.487 +  -e "Add random whirl texture to the last image."
   1.488 +  -v- -n[-1] 0,255 -t float [-1] -f[-1] 0 -noise[-1] 0.3,2 -blur[-1] 3
   1.489 +  -gradient[-1] xyz -a[-3--1] v -norm[-1] -sqrt[-1] -blur[-1] 3 -gradient[-1] xyz
   1.490 +  -a[-3--1] v -norm[-1] -sqrt[-1] -blur[-1] 3 -gradient[-1] xyz -a[-3--1] v
   1.491 +  -norm[-1] -sqrt[-1] -blur[-1] 3 -gradient[-1] xyz -a[-3--1] v -norm[-1]
   1.492 +  -sqrt[-1] -n[-1] 0.8,1.5 -r[-1] [-2] -*[-2,-1] -cut[-1] 0,255 -v+
   1.493 +
   1.494 +# Add water reflection.
   1.495 +#----------------------
   1.496 +#@gmic reflect : (no args) : Add water reflection effect to the last image.
   1.497 +reflect :
   1.498 +  -e "Add water reflection effect to the last image."
   1.499 +  -v- -t float [-1] -mirror[-1] y -r[-1] 100%x100%x100%x3 -s[-1] v -*[-3] 0.8
   1.500 +  -*[-2] 0.9 -a[-3--1] v -water 30,1.5 1x2 -f[-1] 1,0 -r[-1] [-2]x3 -*[-2,-1]
   1.501 +  -a[-2,-1] y -v+
   1.502 +
   1.503 +# B&W Edge filter.
   1.504 +#-----------------
   1.505 +#@gmic edges : 'threshold=30' : Estimate image contours of the last image.
   1.506 +edges : -float ${1=30}
   1.507 +  -e "Estimate last image contours, with threshold $1."
   1.508 +  -v- -t float [-1] -n[-1] 0,255 -gradient_norm -blur[-1] 0.5
   1.509 +  -threshold[-1] $1% -distance[-1] 0 -equalize[-1] 256 -*[-1] -1 -n[-1] 0,255
   1.510 +  -r[-1] [-2] -rm[-2] -v+
   1.511 +
   1.512 +# Cartoon effect.
   1.513 +#----------------
   1.514 +#@gmic cartoon : 'threshold=30' : Apply cartoon effect on the last image.
   1.515 +cartoon : -float ${1=30}
   1.516 +  -e "Apply cartoon effect on the last image, with threshold $1."
   1.517 +  -v- -t float [-1]x2 -edges $1 -r[-2] 8x8x1x3,2 -r[-3] 100%x100%x100%x3
   1.518 +  -rgb2lut[-3] [-2] -lut2rgb[-3] [-2] -rm[-2] -blur[-2] 2 -*[-2--1] -n[-1] 0,255 -v+
   1.519 +
   1.520 +# Drawing effect.
   1.521 +#----------------
   1.522 +#@gmic drawing : (no args) : Apply drawing effect on the last image.
   1.523 +drawing :
   1.524 +  -e "Apply drawing effect on the last image."
   1.525 +  -v- -t float -smooth[-1] 200,0.2,1,3,3 -blur[-1] 2 -sharpen[-1] 1000 [-1]
   1.526 +  -r[-2] 20x20x1x3,2 -equalize[-2] 256 -rgb2lut[-1] [-2],1 -lut2rgb[-1] [-2] -rm[-2] -v+
   1.527 +
   1.528 +# Whirl drawing effect.
   1.529 +#----------------------
   1.530 +#@gmic draw_whirl : (no args) : Apply whirl drawing effect on the last image.
   1.531 +draw_whirl :
   1.532 +  -e "Apply whirl drawing effect on the last image."
   1.533 +  -v- -t float 100%x100% -noise[-1] 70,2 -*[-1] 255 -r[-1] [-2] -and[-1,-2] -smooth[-1] 100,0,1,2,2
   1.534 +  -sqrt[-1] -n[-1] 0,255 -equalize[-1] 256 -v+
   1.535 +
   1.536 +# Paper texture.
   1.537 +#---------------
   1.538 +#@gmic paper_texture : (no args) : Add paper texture to the last image.
   1.539 +paper_texture :
   1.540 +  -e "Add paper texture to the last image."
   1.541 +  -v- -t float [-1] 30%x30% -noise[-1] 1,2 -r[-1] [-2],[-2],[-2],1,0 -ifft[-1]
   1.542 +  -rm[-1] -translate[-1] 50%x50%x50%x0x2 -sharpen[-1] 1 -n[-1] 1,1.2 -r[-1] [-2]
   1.543 +  -*[-2,-1] -cut[-1] [-2],[-2] -rm[-2] -v+
   1.544 +
   1.545 +# B&W Stencil filter.
   1.546 +#--------------------
   1.547 +#@gmic stencilbw : (no args) : Apply B&W stencil effect on the last image.
   1.548 +stencilbw :
   1.549 +  -e "Apply B&W stencil effect on the last image."
   1.550 +  -v- -r[-1] 100%x100%x1x100% -t float [-1] -edges 30 -quantize[-2] 3 -blur[-2] 10
   1.551 +  -sharpen[-2] 1000000 -norm[-2] -n[-2] 0,1 -*[-1,-2] -n[-1] 0,255 -v+
   1.552 +
   1.553 +# B&W Pencil filter.
   1.554 +#-------------------
   1.555 +#@gmic pencilbw : (no args) : Apply B&W pencil effect on the last image.
   1.556 +pencilbw :
   1.557 +  -e "Apply B&W pencil effect on the last image." -v- -r[-1] 100%x100%x1x100%
   1.558 +  -norm[-1] -blur[-1] 0.3 -sharpen[-1] 4000 -smooth[-1] 60,0,1 -equalize[-1] 256
   1.559 +  -sqrt[-1] -n[-1] 0,255 -r[-1] 100%x100%x1x3 -v+
   1.560 +
   1.561 +# B&W dithered filter.
   1.562 +#----------------------
   1.563 +#@gmic ditheredbw : (no args) : Create dithered B&W version of the last image.
   1.564 +ditheredbw :
   1.565 +  -e "Create dithered B&W version of the last image." -v- -n[-1] 0,255
   1.566 +  -r[-1] 100%x100%x100%x3 -i 2x1x1x3 -f[-1] 0,255 -rgb2lut[-2] [-1],1
   1.567 +  -lut2rgb[-2] [-1] -rm[-1] -v+
   1.568 +
   1.569 +# B&W dots effect.
   1.570 +#-----------------
   1.571 +#@gmic dotsbw : (no args) : Apply B&W dots effect on the last image.
   1.572 +dotsbw :
   1.573 +  -e "Apply B&W dots effect on the last image."
   1.574 +  -v- -t float -norm[-1] --r[-1] 10%x10%x1x1x2 [-1]x4 -threshold[-5] 10%
   1.575 +  -threshold[-4] 30% -threshold[-3] 50% -threshold[-2] 70% -threshold[-1] 90%
   1.576 +  -r[-5--1] [-6],4 -translate[-5--1] -5,-5 -rm[-6] -_circle 3 -dilate[-6] [-1]
   1.577 +  -rm[-1] -_circle 5 -dilate[-5] [-1] -rm[-1] -_circle 7 -dilate[-4] [-1]
   1.578 +  -rm[-1] -_circle 9 -dilate[-3] [-1] -rm[-1] -_circle 11 -dilate[-2] [-1]
   1.579 +  -rm[-1] -or[-5--1] -n[-1] 0,255 -r[-1] 100%x100%x1x3 -v+
   1.580 +
   1.581 +# Andy Warhol style.
   1.582 +#-------------------
   1.583 +#@gmic warhol : 'M=3,N=M' : Create a MxN Andy Warhol effect on the last image.
   1.584 +_warhol :
   1.585 +  [-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
   1.586 +  -cut[-1] 0,255 -ycbcr2rgb[-1] -r[-1] 256x1x1x3,3 -sqr[-1] -n[-1] 0,255 -lut2rgb[-2] [-1] -rm[-1] -mv[-1] -2
   1.587 +warhol : -int ${1=3},${2=$1}
   1.588 +  -e "Create a $1x$2 Andy Warhol effect on the last image."
   1.589 +  -v- -t float -norm[-1] -blur[-1] 2 -quantize[-1] 6 -n[-1] 0,255
   1.590 +  -i[0] ($1) -+[0] $2 -/[0] 2 -pow[0] -1 -*[0] 100 -round[0] 1,-1 -r[-1] @0%x@0%x1x1,2
   1.591 +  -f[0] $1 -*[0] $2 -repeat @0 -_warhol -done -rm[0,-1] -append_tile $1,$2 -v+
   1.592 +
   1.593 +# Cubism.
   1.594 +#--------
   1.595 +#@gmic cubism : 'nb_iter=160,bloc_size=30,max_angle=75,opacity=0.7,smoothness=0' : Apply cubism effect on the last image.
   1.596 +_cubism :
   1.597 +   1x1x1x1x2 -rand[-2] 0,@{-3,0} -rand[-1] 0,@{-3,1} -a[-2,-1] x -round[-1] 1 --+[-1] $1 --[-2] $1
   1.598 +   --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]
   1.599 +   -image[-5] [-2],@-3,0,$3,[-1] -rm[-3--1]
   1.600 +
   1.601 +cubism : -int ${1=160},${2=30} -float ${3=75},${4=0.7},${5=0}
   1.602 +  -e "Apply cubism effect on the last image, with $1 iterations, bloc size $2, maximum angle $3, opacity $4 and smoothness $5."
   1.603 +  -v- --dimensions[-1] -repeat $1 -_cubism $2,$3,$4,$5 -done -rm[-1] -v+
   1.604 +
   1.605 +# Soft glow.
   1.606 +#-----------
   1.607 +#@gmic glow : 'amplitude=3' : Apply glow effect on the last image.
   1.608 +glow : -float ${1=3}
   1.609 +  -e "Apply glow effect on the last image, with amplitude $1."
   1.610 +  -v- -t float -r[-1] 100%x100%x1x3 -rgb2ycbcr[-1] -s[-1] v --blur[-3] $1 -n[-1] [-4] -+[-4,-1] -/[-3] 2
   1.611 +  -a[-3--1] v -ycbcr2rgb[-1] -v+
   1.612 +
   1.613 +# Old photo filter.
   1.614 +#------------------
   1.615 +#@gmic old_photo : (no args) : Apply old photo effect on the last image.
   1.616 +old_photo :
   1.617 +  -e "Apply old photo effect on the last image."
   1.618 +  -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+
   1.619 +
   1.620 +#-------------------------
   1.621 +#
   1.622 +# Color filters
   1.623 +#
   1.624 +#-------------------------
   1.625 +
   1.626 +# Compute luminance.
   1.627 +#-------------------
   1.628 +#@gmic luminance : (no args) : Compute luminance of the last image.
   1.629 +luminance :
   1.630 +  -e "Compute luminance of the last image."
   1.631 +  -v- -n[-1] 0,255 -r[-1] 100%x100%x1x3 -rgb2ycbcr[-1] -channels[-1] 0 -v+
   1.632 +
   1.633 +# Apply a 3x3 transformation matrix to RGB vectors.
   1.634 +#---------------------------------------------------
   1.635 +#@gmic mix_rgb : a11,a12,a13,a21,a22,a23,a31,a32,a33 : Apply 3x3 specified matrix to RGB colors.
   1.636 +mix_rgb : -float ${1=1},${2=0},${3=0},${4=0},${5=1},${6=0},${7=0},${8=0},${9=1}
   1.637 +  -e "Apply matrix [ $1 $2 $3 ; $4 $5 $6 ; $7 $8 $9 ] to RGB pixels of the last image."
   1.638 +  -v- -t float -r[-1] 100%x100%x1x3,0,2 -s[-1] v
   1.639 +  --*[-3] $4 --*[-3] $5 -+[-1,-2] --*[-2] $6 -+[-1,-2]
   1.640 +  --*[-4] $7 --*[-4] $8 -+[-1,-2] --*[-3] $9 -+[-1,-2]
   1.641 +  -*[-5] $1 -*[-4] $2 -*[-3] $3 -+[-5--3]
   1.642 +  -a[-3--1] v -v+
   1.643 +
   1.644 +# Solarize.
   1.645 +#----------
   1.646 +#@gmic solarize : (no args) : Apply solarization effect on the last image.
   1.647 +solarize :
   1.648 +  -e "Apply solarization effect on the last image."
   1.649 +  -v- -luminance -n[-1] 0,128 -lut2rgb[-1] 1 -v+
   1.650 +
   1.651 +# Sepia filter.
   1.652 +#--------------
   1.653 +#@gmic sepia : (no args) : Apply sepia tones filter on the last image.
   1.654 +_sepia :
   1.655 +  -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
   1.656 +sepia :
   1.657 +  -e "Apply sepia tones filter on the last image."
   1.658 +  -v- -luminance -_sepia -lut2rgb[-2] [-1] -rm[-1] -v+
   1.659 +
   1.660 +# Negative.
   1.661 +#----------
   1.662 +#@gmic negative : (no args) : Compute negative of last image negative.
   1.663 +negative :
   1.664 +  -e "Compute negative of the last image."
   1.665 +  -v- -t float -*[-1] -1 [-1] -stats[-1] -c[-1] 0,0,0,0 -r[-1] [-2] --[-1,-2] -v+
   1.666 +
   1.667 +# Select RGB pixels in an image.
   1.668 +#--------------------------------
   1.669 +#@gmic select_rgb : 'R=0,G=0,B=0,tolerance=10' : Select RGB colored pixels in the last image.
   1.670 +select_rgb :
   1.671 +  -e "Select RGB color ($(1=0),$(2=0),$(3=0)) in the last image, with tolerance $(4=30)."
   1.672 +  -v- 1x1x1x3 -f[-1] $1,$2,$3 -r[-1] [-2] --[-2,-1] -norm[-1] -threshold[-1] $4 -negative -v+
   1.673 +
   1.674 +# Fill image with RGB color.
   1.675 +#---------------------------
   1.676 +#@gmic fill_rgb : 'R=0,G=0,B=0' : Fill last image with specified RGB color.
   1.677 +fill_rgb :
   1.678 +  -e "Fill last image with RGB color ($(1=0),$(2=$1),$(3=$2))."
   1.679 +  -dimensions[-1] ($1^$2^$3) -r[-1] @-2 -rm[-2]
   1.680 +
   1.681 +#-------------------------
   1.682 +#
   1.683 +# Motion related filters
   1.684 +#
   1.685 +#-------------------------
   1.686 +
   1.687 +# Cross-correlation and normalized cross-correlation.
   1.688 +#-----------------------------------------------------
   1.689 +#@gmic cross_correlation : (no args) : Compute cross-correlation between the two last images.
   1.690 +cross_correlation :
   1.691 +  -e "Compute cross-correlation between the two last images."
   1.692 +  -v- -t float -norm[-2,-1] -fft[-2] -fft[-1] [-2,-1] -mul[-2] [-5] -mul[-1] [-6]
   1.693 +  --[-2,-1] -*[-5,-3] -*[-3,-2] -+[-3,-2] -ifft[-2,-1] -rm[-1] -v+
   1.694 +
   1.695 +#@gmic normalized_cross_correlation : (no args) : Compute normalized cross-correlation between the two last images.
   1.696 +normalized_cross_correlation :
   1.697 +  -e "Compute normalized cross-correlation between the two last images."
   1.698 +  -v- -t float -norm[-2,-1] -fft[-2] -fft[-1] [-2,-1] -mul[-2] [-5] -mul[-1] [-6]
   1.699 +  --[-2,-1] -*[-5,-3] -*[-3,-2] -+[-3,-2] [-2,-1] -a[-2,-1] v -norm[-1]
   1.700 +  -/[-3] [-1] -/[-2,-1] -ifft[-2,-1] -rm[-1] -v+
   1.701 +
   1.702 +# Phase correlation.
   1.703 +#-------------------
   1.704 +#@gmic phase_correlation : (no args) : Estimate translation vector between the two last images by the phase correlation method.
   1.705 +phase_correlation :
   1.706 +  -e "Compute phase correlation between the two last images."
   1.707 +  -v- -normalized_cross_correlation -stats[-1] -c[-1] 0,8,0,10 -r[-1] 1,1,1,3,-1 -v+
   1.708 +
   1.709 +# Compute a morphing sequence (between the two latest images).
   1.710 +#-------------------------------------------------------------
   1.711 +#@gmic morph : 'N=10,smoothness=0.2' : Compute morphing sequence between the two latest images.
   1.712 +morph : -int ${1=10} -float ${2=0.2}
   1.713 +  -e "Compute morphing sequence with $1 frames and smoothness $2."
   1.714 +  -v- -t float -r[-1] [-2],3 [-2] -displacement[-1] [-2],$2
   1.715 +  -warp[-3] [-1],1,1,1,$1 -*[-1] -1 -warp[-2] [-1],1,1,1,$1 -rm[-1]
   1.716 +  -a[-$1--1] z -reverse -a[-$1--1] z
   1.717 +  1x1x2 -f[-1] 0,1 -r[-1] [-2],3 -*[-2] [-1] -*[-1] -1 -+[-1] 1 -*[-3,-1]
   1.718 +  -+[-2,-1] -s[-1] z -reverse[-$1--1] -v+
   1.719 +
   1.720 +# Register two latest images with a rigid or non-rigid warp.
   1.721 +#------------------------------------------------------------
   1.722 +#@gmic register : 'method=0' : Register last image with the penultimate image ('method' can be '{0=translation, 1=non-rigid warp}').
   1.723 +_register1 :
   1.724 +  -e "Align last and penultimate images with non-rigid warp."
   1.725 +  -v- -t float -r[-1] [-2],3 [-1] -displacement[-1] [-3],1.2 -warp[-2] [-1],1 -rm[-1] -v+
   1.726 +_register0 :
   1.727 +  -e "Align last and penultimate images with translation."
   1.728 +  -v- -t float -r[-1] [-2],3 [-2,-1] -blur[-2,-1] 2 -equalize[-2,-1] 256 -phase_correlation -r[-1] [-2],[-2]
   1.729 +  -warp[-2] [-1],1,1,2,1 -rm[-1] -v+
   1.730 +register : -int ${1=1}
   1.731 +  -if $1 -_register1 -else -_register0 -endif
   1.732 +
   1.733 +#-------------------------
   1.734 +#
   1.735 +# Video related filters
   1.736 +#
   1.737 +#-------------------------
   1.738 +
   1.739 +# Deinterlace frame.
   1.740 +#-------------------
   1.741 +#@gmic deinterlace : 'method=0' : Deinterlace last image by a simple algorithm ('method' can be 0=simple or 1=motion-compensated).
   1.742 +_deinterlace0 :
   1.743 +  -e "Deinterlace last image with simple method."
   1.744 +  -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]
   1.745 +  -/[-1] 2 -rm[-2] -v+
   1.746 +_deinterlace1 :
   1.747 +  -e "Deinterlace last image with motion-compensated method."
   1.748 +  -v- -t float -k[-1] -s[-1] y -a[0--1:2] y -a[1--1] y -r[-2] [-1],0
   1.749 +  -r[-1,-2] 100%x200%x1x100%x5 [-2] -displacement[-1] [-2]x0.01
   1.750 +  -warp[-3] [-1],1,1,1,2 -*[-1] -1 -warp[-2] [-1],1,1,1,2 -rm[-1] -k[-2,-4] -+[-1,-2]
   1.751 +  -/[-1] 2 -v+
   1.752 +deinterlace :
   1.753 +  -_deinterlace${1=0]
   1.754 +
   1.755 +# Predator effect. (first image must be the reference background, second image is the one to process).
   1.756 +#---------------------------------------------------------------------------------------------------
   1.757 +#@gmic predator : (no args) : Apply predator effect on the last image using background as the penultimate image.
   1.758 +predator :
   1.759 +  -e "Apply predator effect on the last image."
   1.760 +  -v- -t float -equalize[-2--1] 256 --[-1] [-2] -sqr[-1] -cut[-1] 20%,100%
   1.761 +  -blur[-1] 1 -n[-1] 0,30 -channels[-1] 0,1 -warp[-2] [-1],1,1 -rm[-1] -v+
   1.762 +
   1.763 +#-------------------------
   1.764 +#
   1.765 +# Other various filters
   1.766 +#
   1.767 +#-------------------------
   1.768 +
   1.769 +# Horizontal fading.
   1.770 +#-------------------
   1.771 +#@gmic fade_x : 'start=30,end=70' : Create an horizontal fading transition between the two last images ('start' and 'end' in [0..100]).
   1.772 +_fade : -float ${1=30},${2=70}
   1.773 +  -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]
   1.774 +fade_x :
   1.775 + -e "Create ($1%,$2%) horizontal fading transition between the two last images."
   1.776 + -v- 2 -f[-1] 0,1 -_fade $1,$2 -v+
   1.777 +
   1.778 +# Vertical fading.
   1.779 +#-----------------
   1.780 +#@gmic fade_y : 'start=30,end=70' : Create a vertical fading transition between the two last images ('start' and 'end' in [0..100]).
   1.781 +fade_y : -float ${1=30},${2=70}
   1.782 +  -e "Create ($1%,$2%) vertical fading transition between the two last images."
   1.783 +  -v- 1x2 -f[-1] 0,1 -_fade $1,$2 -v+
   1.784 +
   1.785 +# Radial fading.
   1.786 +#---------------
   1.787 +#@gmic fade_radial : 'start=30,end=70' : Create radial fading transition between the two last images ('start' and 'end' in [0..100]).
   1.788 +fade_radial : -float ${1=30},${2=70}
   1.789 +  -e "Create ($1%,$2%) radial fading transition between the two last images."
   1.790 +  -v- 100%x100% -point 50%,50%,0,1,1 -distance[-1] 1 -_fade $1,$2 -v+
   1.791 +
   1.792 +# Diamond fading.
   1.793 +#----------------
   1.794 +#@gmic fade_diamond : 'start=70,end=90' : Create diamond-shaped fading transition between the two last images ('start' and 'end' in [0..100]).
   1.795 +fade_diamond : -float ${1=70},${2=90}
   1.796 +  -e "Create ($1%,$2%) diamond-shaped fading transition between the two last images."
   1.797 +  -v- 3x3 -f[-1] 0,1,0,1,1,1,0,1,0 -_fade $1,$2 -v+
   1.798 +
   1.799 +# Image composition : try to generate an image containing all details of an image list.
   1.800 +# Usage : gmic image1.jpg -compose_add image2.jpg -compose_add ... imageN.jpg  -compose_add -compose
   1.801 +#----------------------------------------------------------------------------------------------------
   1.802 +#@gmic compose_add : (no args) : Generate composition image from the last image (to be used with '-compose').
   1.803 +compose_add :
   1.804 +  -e "Generate composition image."
   1.805 +  -v- [-1] -gradient_norm -blur[-1] 2 -n[-1] 1,10 -sqr[-1] -s[-2] v -*[-4] [-1]
   1.806 +  -*[-3] [-1] -*[-2] [-1] -a[-4--1] v -v+
   1.807 +
   1.808 +#@gmic compose : (no args) : Compose images of the list togethers.
   1.809 +compose :
   1.810 +  -e "Compose all images of the list togethers."
   1.811 +  -v- -r [0],[0],1,4,0 -r [-1],3 -+ -s[-1] v -/[-4] [-1] -/[-3] [-1] -/[-2] [-1]
   1.812 +  -rm[-1] -a v -v+
   1.813 +
   1.814 +# Multiply composition.
   1.815 +#----------------------
   1.816 +#@gmic compose_multiply : (no args) : Compose the penultimate image with the last one, using multiply composition.
   1.817 +compose_multiply :
   1.818 +  -e "Compose the penultimate image with the last one, using multiply composition."
   1.819 +  -v- -t float -r[-1] 100%x100%x1x[-2] -r[-1] [-2],3 -/[-1] 255 -*[-2,-1] -v+
   1.820 +
   1.821 +# Screen composition.
   1.822 +#---------------------
   1.823 +#@gmic compose_screen : (no args) : Compose the penultimate image with the last one, using screen composition.
   1.824 +compose_screen :
   1.825 +  -e "Compose the penultimate image with the last one, using screen composition."
   1.826 +  -v- -t float -r[-1] 100%x100%x1x[-2] -r[-1] [-2],3 -/[-1] 255
   1.827 +  -*[-1] 1 -+[-1] 1 -*[-2] -1 -+[-2] 255 -*[-2,-1] -*[-1] -1 -+[-1] 255 -v+
   1.828 +
   1.829 +# Overlay composition.
   1.830 +#---------------------
   1.831 +#@gmic compose_overlay : (no args) : Compose the penultimate image with the last one, using overlay composition.
   1.832 +compose_overlay :
   1.833 +  -e "Compose the penultimate image with the last one, using overlay composition."
   1.834 +  -v- -t float -r[-1] 100%x100%x1x[-2] -r[-1] [-2],3 -/[-1] 255
   1.835 +  --threshold[-1] 0.5 --*[-3] 4 -+[-1] 510 -*[-1] [-3] --[-1] 255
   1.836 +  -*[-4] 2 -+[-1] [-4] -*[-4,-3] -*[-3,-2] -+[-2,-1] -v+
   1.837 +
   1.838 +# Print the factorial of an integer.
   1.839 +#-----------------------------------
   1.840 +#@gmic factorial : 'N' : Print the factorial of the integer 'N'.
   1.841 +factorial : -int $1
   1.842 +  -v- ($1) -+[-1] 1 -if @-1 (1) (1) -repeat $1 -*[-1] @-2 -+[-2] 1 -done -v+ -e "Factorial($1) = @-1" -v- -rm[-3--1]
   1.843 +  -else -echo "Factorial($1) is undefined." -q -endif -v+
   1.844 +
   1.845 +# This is a sucking easter-egg ! (R-Rated).
   1.846 +#------------------------------------------
   1.847 +dick3d :
   1.848 +  -e ""
   1.849 +  -e "!!********************************************************!!"
   1.850 +  -e "!! Congratulations ! You have found the hidden Easter-egg !!"
   1.851 +  -e "!!********************************************************!!"
   1.852 +  -e ""
   1.853 +  -v- -rm -t float 2 1x2 1x1x2 -f -1,1 -r 100x100x100x1x3 -sqr -+ -* -8 -exp
   1.854 +  [0]x2 -translate[-1] 20 -translate[-2] -20 -+[-1,-2] -translate[-1] 0,-20
   1.855 +  -r[-2] 100x220x100x1x3 -r[-2] 100x100x100x3,0,0,1 -translate[-2] 0,10 -+
   1.856 +  -isovalue3d 0.5 -rd3d 4 -d3d -v+
   1.857 +
   1.858 +# Create 3D centered unit mapped cube from an image.
   1.859 +#---------------------------------------------------
   1.860 +#@gmic imagecube3d : 'resolution' : Create a 3D mapped cube from the last image.
   1.861 +imagecube3d : -int ${1=128}
   1.862 +  -e "Create 3D mapped cube of size $1x$1x$1 from last image."
   1.863 +  -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
   1.864 +  -+3d[-2,-1] --rot3d[-1] 0,1,0,90 --rot3d[-2] 1,0,0,90 -+3d[-3--1] -v+
   1.865 +
   1.866 +# Local Variables:
   1.867 +# mode: sh
   1.868 +# End:
   1.869 +#
   1.870 +# (End of G'MIC macro file)