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