The G'MIC documentation is a verbatim copy of what you get when calling gmic
from the command line, with the -h, -help or --help options.
It may look a bit forbidding, but it actually describes the complete syntax of the G'MIC language,
as well as all available default commands. Examples of use are provided at the end of this documentation.
gmic : GREYC's Magic Image Converter (Nov 24 2009, 15:42:42)
Version 1.3.3.0, Copyright (C) 2008-2009, David Tschumperle (http://gmic.sourceforge.net)
Usage
-----
gmic [file1 | instruction1 [arg1_1,arg1_2,..]] .. [fileN | instructionN [argN_1,argN_2,..]]
'gmic' is an open-source interpreter of the G'MIC language, a minimal script-based
programming language dedicated to the design of complex image processing pipelines.
It can be typically used to convert, manipulate, and visualize datasets composed of
one or several 1D/2D/3D multi-spectral images.
The G'MIC language is small and quite easy to learn. It follows these simple rules :
- At any time, one considers a numbered list of images which are all stored in
computer memory.
- Pixels of all these images have the same datatype which is one of the following types:
{ bool | uchar | char | ushort | short | uint | int | float | double }.
- The first image of the list has indice '0' and is denoted by [0].
- Negative indices are treated in a cyclic way (i.e. image [-1] stands for the
last image, [-2] the penultimate one, and so on..).
- An image processing pipeline is described as a sequence of G'MIC items,
separated by spaces ' ', read and interpreted from the left to the right.
- Items can be either commands, command arguments, filenames or input strings.
- On the command line, any string following 'gmic' is considered as a G'MIC item.
- An item starting by '-' usually designates a G'MIC command.
- Some command may have two equivalent names (regular and short, for instance
command items '-resize' and '-r' are strictly equivalent).
- A command may have mandatory or optional arguments.
- The command argument is the item directly following the command name.
- When multiple arguments are required, they are separated by commas ','.
- When an input filename or an input string is encountered, the corresponding
image data are loaded/created and inserted at the end of the image list
(this is actually similar to giving an argument to the command '-input' or '-i').
- Filenames '-' and '-.ext' stand for the standard input/output streams
(optionally, with data forced to be in the specified 'ext' file format).
- Input strings can be used to insert new images "from scratch" at the end of the list :
_ 'width[%],_height[%],_depth[%],_spectrum[%],_values' :
Insert a new image with specified dimensions and values (adding '%' to a
dimension means 'percentage of the same dimension, get from the last
available image'). A dimension 'width','height','depth' or 'spectrum' can be
also written as '[indice]' in which case its value is taken from the same
dimension of the specified existing image [indice].
_ '[indice]' or '[indice]xN' : Insert 1 or N copies of the image [indice].
_ '(v1,v2,..)' : Create a new image containing the specified values.
Value separators inside parentheses can be ',' (column), ';' (line),
'/' (slice) or '^' (channel).
- The execution of a command may be restricted to a sub-selection of the image
list, by appending '[selection]' to the command name.
Selections can be defined in many different ways. For instance :
_ '-command[0,1,3]' : Apply command only on images [0],[1] and [3].
_ '-command[3-5]' : Apply command only on images [3] to [5]
(i.e. on images [3], [4] and [5]).
_ '-command[50%-100%]' : Apply command on the second half of the image list.
_ '-command[0,-4--1]' : Apply command on the first and the four latest images.
_ '-command[0-9:3]' : Apply command only on images 0 to 9, with a step of 3
(i.e. on images [0], [3], [6] and [9]).
_ '-command[0,2-4,50%--1]' : Apply command on images [0],[2],[3],[4] and on
the second half of the image list.
- When no selection is specified, a command is applied by default on all images.
- A command starting with '--' instead of '-' does not act 'in-place' but inserts
its result as one or several new image(s), at the end of the list.
- Any expression starting with '@' in an item is substituted before item interpretation :
_ '@#' is substituted by the current number of images in the list.
_ '@*' is substituted by the current number of items in the global stack.
_ '@{*}' or '@{*,subset}' are substituted by the stack content, or a subset of it.
_ '@>' and '@<' are substituted by the current number of running 'repeat-done' loops.
_ '@{>}' or '@{>,subset}' are substituted by the indices (or a subset of them) of
the running 'repeat-done' loops, given in ascending order, from 0 to N-1.
_ '@{<}' or '@{<,subset}' do the same in descending order, from N-1 to 0.
_ '@!' is substituted by the visibility state of the instant display window [0]
(can be { 0=closed | 1=visible }).
_ '@{!,feature}' or '@{!indice,feature}' is substituted by a specific feature of the
instant display window [0] (or [indice], if specified). The retrieved 'feature' can be
one of the followings :
. 'w' : get display width.
. 'h' : get display height.
. 'u' : get screen width (do not depend on the instant window).
.' v' : get screen height (do not depend on the instant window).
. 'x' : get X-coordinate of the mouse position.
. 'y' : get Y-coordinate of the mouse position.
. 'n' : get type of normalization.
. 'b' : get state of the mouse buttons.
. 'o' : get state of the mouse wheel.
. 'c' : get boolean telling if the instant display has been closed.
. 'r' : get boolean telling if the instant display has been resized.
. 'm' : get boolean telling if the instant display window has been moved.
. Any other feature describe a key name whose state { 0=pressed | 1=released } is returned.
_ '@indice' or '@{indice,feature}' is substituted by the pixel values of the image [indice],
or by a specific feature (or subset) of this image.
The retrieved 'feature' can be one of the followings :
. 'w' : get image width (number of columns).
. 'h' : get image height (number of lines).
. 'd' : get image depth (number of slices).
. 's' : get image spectrum (number of channels).
. '#' : get number of image values (width x height x depth x spectrum).
. '+' : get sum of all pixel values.
. '-' : get difference of all pixel values.
. '*' : get product of all pixel values.
. '/' : get quotient of all pixel values.
. 'm' : get minimum pixel value.
. 'M' : get maximum pixel value.
. 'a' : get average pixel value.
. 'v' : get variance of pixel values.
. 't' : get text string from the image values, regarded as ASCII codes.
. 'c' : get (x,y,z,c) coordinates of the minimum value.
. 'C' : get (x,y,z,c) coordinates of the maximum value.
. '(x,_y,_z,_c,_borders)' : get pixel value at coordinates (x,y,z,c).
Any other 'feature' is considered as a desired subset of image values, for
instance, expression '@{-1,0-50%}' is substituted by all values (separated
by commas ',') coming from the first half of the last image.
- Any other expression involving braces (as '{expression}') is considered as a mathematical
expression and is evaluated. If the string is not evaluable (invalid expression), it is replaced by
the sequence of ASCII codes that compose the string, separated by commas ','.
- "Items" delimited by double quotes '"' may contain spaces, commas or ESC sequences.
- Some G'MIC commands may result to the generation of 3D objects.
- In G'MIC, a 3D object is stored as a one-column image, containing all object data, in the
following order : [ header, vertices, faces, colors, opacities ].
- Custom G'MIC commands can be defined by the user, through a command file.
- A command file is a simple ASCII text file, where each line starts either by
'instruction_name : substitution' or 'substitution (continuation)' or '# comment'.
- A default command file 'gmic_def.raw' is distributed within the G'MIC package.
Looking at it is a good start to learn how to create your own custom commands.
- Commands defined in file 'gmic_def.raw' are already included by default in the
interpreter. Their explicit inclusion (using command '-m') is useless.
- In custom commands, expressions starting with '$' are substituted this way :
_ '$#' is substituted by the number of specified arguments.
_ '$*' is substituted by all specified arguments, separated by commas ','.
_ '$i' and '${i}' are substituted by the i-th specified argument
('i' starts from '1' to '$#').
_ '${i*}' is substituted by all arguments whose indice is higher or equal to i.
_ '${i=default}' is substituted by the value of $i (if defined) or by its new
default value 'default' else ('default' can be a $-expression as well).
_ '$?' is substituted by a string telling about the image selection
(should be used in command descriptions only).
All currently recognized G'MIC commands are listed below.
Possible formats for required command arguments (if any) are separated by '|'.
An argument specified in '[]' or starting by '_' is optional except when standing for
an existing image [indice] of the current image list. In this case, the characters
'[' and ']' are mandatory when writting the item.
Global options
--------------
-help _command
Display help (optionally for specified command only) and quit.
(eq. to '-h').
-verbose level
Set verbosity level to 'level'.
(eq. to '-v').
When 'level>=0', execution messages are send to the standard output stream.
Default value for 'level' is '0'.
-verbose+
Increment verbosity level.
(eq. to '-v+').
-verbose-
Decrement verbosity level.
(eq. to '-v-').
-command filename |
"string"
Import G'MIC command(s) from specified file or string.
(eq. to '-m').
Custom commands can be used directly after the command execution.
-debug
Switch debug flag.
When activated, the debug mode outputs additionnal log message describing the
internal state of the interpreter. Should be used by developers only.
-fullpath
Switch full path flag.
When activated, the displayed image names contains the full path filename
including the location folders.
Arithmetic operators
--------------------
-add value |
[indice] |
'filename' |
'formula' |
(no args)
Add value 'value', image [indice] or 'filename', mathematical expression 'formula'
to selected images, or add all selected images together.
(eq. to '-+').
-sub value |
[indice] |
'filename' |
'formula' |
(no args)
Substract value 'value', image [indice] or 'filename', mathematical expression 'formula'
to selected images, or substract all selected images together.
(eq. to '--').
-mul value |
[indice] |
'filename' |
'formula' |
(no args)
Multiply selected images by value 'value', image [indice] or 'filename', mathematical
expression 'formula', or multiply all selected images together.
(eq. to '-*').
-div value |
[indice] |
'filename' |
'formula' |
(no args)
Divide selected image by value 'value', image [indice] or 'filename', mathematical
expression 'formula', or divide all selected images together.
(eq. to '-/').
-pow value |
[indice] |
'filename' |
'formula' |
(no args)
Compute selected image to the power of value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute power of all selected images together.
(eq. to '-^').
-min value |
[indice] |
'filename' |
'formula' |
(no args)
Compute minimum between selected images and value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute minimum of all selected images together.
-max value |
[indice] |
'filename' |
'formula' |
(no args)
Compute maximum between selected images and value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute maximum of all selected images together.
-mod value |
[indice] |
'filename' |
'formula' |
(no args)
Compute modulo of selected images with value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute modulo of all selected images together.
-and value |
[indice] |
'filename' |
'formula' |
(no args)
Compute bitwise AND of selected images with value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute bitwise AND of all selected images together.
-or value |
[indice] |
'filename' |
'formula' |
(no args)
Compute bitwise OR of selected images with value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute bitwise OR of all selected images together.
-xor value |
[indice] |
'filename' |
'formula' |
(no args)
Compute bitwise XOR of selected images with value 'value', image [indice] or 'filename',
mathematical expression 'formula', or compute bitwise XOR of all selected images together.
-cos
Compute pointwise cosine values of selected images.
-sin
Compute pointwise sine values of selected images.
-tan
Compute pointwise tangent values of selected images.
-acos
Compute pointwise arc-cosine values of selected images.
-asin
Compute pointwise arc-sine values of selected images.
-atan
Compute pointwise arc-tangent values of selected images.
-atan2 [indice]
Compute pointwise oriented arc-tangent values of selected images.
The selected images are regarded as containing the y-arguments while the specified
argument gives the corresponding x-arguments of the atan2() function.
-abs
Compute pointwise absolute values of selected images.
-sqr
Compute pointwise square values of selected images.
-sqrt
Compute pointwise square root values of selected images.
-exp
Compute pointwise exponential values of selected images.
-log
Compute pointwise logarithm values of selected images.
-log10
Compute pointwise logarithm_10 values of selected images.
Basic pixel manipulation
------------------------
-type datatype
Cast all images into specified 'datatype'.
'datatype' can be only 'float' in current minimal mode.
-set value,_x,_y,_z,_c
Set scalar value at specified location in selected images.
(eq. to '-=').
If specified location is outside image bounds, nothing happens.
Default values for '_x','_y','_z','_v' are '0'.
-endian
Invert data endianness of selected image buffers.
-fill value1,value2,.. |
[indice] |
formula
Fill selected images with values taken from specified value list, existing image
or mathematical expression.
(eq. to '-f').
-threshold value[%],_soft |
(no args)
Threshold pixel values of selected images.
(eq. to '-t').
'_soft' can be { 0=hard thresholding | 1=soft thresholding }.
(noargs) runs interactive mode (uses the instant window [0] if opened).
-cut { value_min[%] | [indice_min] },{ value_max[%] | [indice_max] } |
[indice] |
(no args)
Cut pixel values of selected images in specified range.
(eq. to '-c').
(noargs) runs interactive mode (uses the instant window [0] if opened).
-normalize { value_min[%] | [indice] },{ value_max[%] | [indice] }
[indice]
Linearly normalize pixel values of selected images in specified range.
(eq. to '-n').
-round rounding_value>=0,_rounding_type
Round pixel values of selected images.
'_rounding_type' can be { -1=backward | 0=nearest | 1=forward }.
-equalize nb_levels>0[%],_value_min[%],_value_max[%]
Equalize histograms of selected images.
When range [_valmin,_valmax] is specified the equalization is done only
on the specified value range.
-quantize nb_levels>0,_preserve_value_range={0|1}
Uniformly quantize selected images.
-noise std_variation>=0[%],_noise_type
Add random noise to selected images.
'noise_type' can be { 0=gaussian | 1=uniform | 2=salt&pepper | 3=poisson | 4=rice }.
-rand value_min,value_max
Fill selected images with random values in specified range.
-norm
Compute pointwise L2-norm of pixels in selected images.
-orientation
Compute pointwise orientation of pixels in selected images.
-map [indice] |
predefined_palette
Map vector-valued palette to selected indexed scalar images.
'predefined_palette' can be { 0=default | 1=rainbow | 2=cluster }.
-index { [indice] | predefined_palette },_is_dithered={0|1},_map_palette={0|1}
Index selected vector-valued images by specified palette.
'predefined_palette' can be { 0=default | 1=rainbow | 2=cluster }.
Color bases conversions
-----------------------
-rgb2hsv
Convert selected images from RGB to HSV colorbases.
-rgb2hsl
Convert selected images from RGB to HSL colorbases.
-rgb2hsi
Convert selected images from RGB to HSI colorbases.
-rgb2yuv
Convert selected images from RGB to YUV colorbases.
-rgb2ycbcr
Convert selected images from RGB to YCbCr colorbases.
-rgb2xyz
Convert selected images from RGB to XYZ colorbases.
-rgb2lab
Convert selected images from RGB to Lab colorbases.
-rgb2cmy
Convert selected images from RGB to CMY colorbases.
-rgb2cmyk
Convert selected images from RGB to CMYK colorbases.
-hsv2rgb
Convert selected images from HSV to RGB colorbases.
-hsl2rgb
Convert selected images from HSL to RGB colorbases.
-hsi2rgb
Convert selected images from HSI to RGB colorbases.
-yuv2rgb
Convert selected images from YUV to RGB colorbases.
-ycbcr2rgb
Convert selected images from YCbCr to RGB colorbases.
-xyz2rgb
Convert selected images from XYZ to RGB colorbases.
-lab2rgb
Convert selected images from Lab to RGB colorbases.
-cmy2rgb
Convert selected images from CMY to RGB colorbases.
-cmyk2rgb
Convert selected images from CMYK to RGB colorbases.
Geometric manipulation
----------------------
-resize [indice],_interpolation,_borders,_center={0|1} |
{[indice] | width>0[%]},_{[indice] | height>0[%]},_{[indice] | depth>0[%]},
_{[indice] | spectrum>0[%]},_interpolation,_borders,_center |
(noargs)
Resize selected images with specified geometry and interpolation.
(eq. to '-r').
'interpolation' can be { -1=none (memory) | 0=none | 1=nearest | 2=average |
3=linear | 4=grid | 5=cubic }.
'borders' can be { -1=none, 2=zero, 3=nearest, 2=repeat }.
(noargs) runs interactive mode (uses the instant window [0] if opened).
-resize2x
Resize selected images using the Scale2x algorithm.
-resize3x
Resize selected images using the Scale3x algorithm.
-crop x0[%],x1[%],_borders={0|1} |
x0[%],y0[%],x1[%],y1[%],_borders |
x0[%],y0[%],z0[%],x1[%],y1[%],z1[%],_borders |
x0[%],y0[%],z0[%],v0[%],x1[%],y1[%],z1[%],v1[%],_borders |
(noargs)
Crop selected images from specified geometry.
(noargs) runs interactive mode (uses the instant window [0] if opened).
-autocrop color1,color2,..
Autocrop selected images using the specified background color.
-channels { [ind0] | v0[%] },_{ [ind1] | v1[%] }
Select channels v0..v1 of selected images.
-slices { [ind0] | z0[%] },_{ [ind1] | z1[%] }
Select slices z0..z1 of selected images.
-lines { [ind0] | y0[%] },_{ [ind1] | y1[%] }
Select lines y0..y1 of selected images.
-columns { [ind0] | x0[%] },_{ [ind1] | x1[%] }
Select columns x0..x1 of selected images.
-rotate angle,_borders,_interpolation,_cx[%],_cy[%],_zoom
Rotate selected images with a given angle.
'borders' can be { 0=zero | 1=nearest | 2=cyclic }.
'interpolation' can be { 0=none | 1=linear | 2=cubic }.
If center ('cx','cy') is specified, the rotation is done in-place.
-mirror axis={x|y|z|c}
Mirror selected images along specified axis.
-shift sx[%],_sy[%],_sz[%],_sv[%],_borders
Shift selected images by specified translation vector.
'borders' can be { 0=zero | 1=nearest | 2=cyclic }.
-transpose
Transpose selected images.
-invert
Compute inverse of the selected images, viewed as matrices.
-permute permutation
Permute selected image axes by specified permutation.
'permutation' is a combination of the character set {x|y|z|c},
for istance 'xycz', 'cxyz', ...
-unroll axis={x|y|z|c}
Unroll selected images along specified axis.
-split axis={x|y|z|c},_parts>0 |
patch_x>0,_patch_y>0,_patch_z>0,_patch_v>0,borders={0|1} |
value,_keep_splitting_values={0|1}
Split selected images along specified axis, patch or scalar value.
(eq. to '-s').
-append axis={x|y|z|c},_alignement
Append selected images along specified axis.
(eq. to '-a').
'alignement' can be { p=left | c=center | n=right }.
-warp [indice],_is_relative={0|1},_interpolation={0|1},_borders,_nb_frames
Warp selected image with specified displacement field.
'borders' can be { 0=zero | 1=nearest | 2=cyclic }.
Image filtering
---------------
-blur std>=0[%],_borders={0|1}
Blur selected images by a quasi-gaussian recursive filter.
-bilateral std_s>0[%],std_r>0
Blur selected images by anisotropic bilateral filtering.
-denoise std_s>=0,_std_p>=0,_patch_size>0,_lookup_size>0,_smoothness,_approx={0|1}
Denoise selected images with a patch-averaging procedure.
-smooth amplitude>=0,_sharpness>=0,_anisotropy,_alpha,_sigma,_dl>0,_da>0,_precision>0,
interpolation,_fast_approx={0|1} |
nb_iters>=0,_sharpness>=0,_anisotropy,_alpha,_sigma,_dt>0,0 |
[indice],_amplitude>=0,_dl>0,_da>0,_precision>0,_interpolation,_fast_approx={0|1} |
[indice],_nb_iters>=0,_dt>0,0
Smooth selected images anisotropically using diffusion PDE's.
'_anisotropy' must be in [0,1].
'_interpolation' can be { 0=nearest, 1=linear, 2=runge-kutta }.
-edgetensors sharpness>=0,_anisotropy,_alpha,_sigma,is_sqrt={0|1}
Compute diffusion tensors for edge-preserving smoothing from selected images.
'_anisotropy' must be in [0,1].
-median radius>=0
Apply median filter of specified radius on selected images.
-sharpen amplitude>=0 |
amplitude>=0,1,_edge>=0,_alpha,_sigma
Sharpen selected images by inverse diffusion or shock filters methods.
-convolve [indice],_borders={0|1}
Convolve selected images by specified mask.
-correlate [indice],_borders={0|1}
Correlate selected images by specified mask.
-erode size>=0' |
size_x>=0,size_y>=0,_size_z>=0 |
[indice],_borders={0|1}
Erode selected images by specified mask.
-dilate size>=0 |
size_x>=0,size_y>=0,size_z>=0 |
[indice],_borders={0|1}
Dilate selected images by specified mask.
-inpaint [indice]
Inpaint selected images by specified mask.
-gradient {x|y|z}..{x|y|z} |
(no args)
Compute gradient components of selected images.
(no args) compute all significant components.
-hessian {xx|xy|xz|yy|yz|zz}..{xx|xy|xz|yy|yz|zz} |
(no args)
Compute hessian components of selected images.
(no args) compute all significant components.
-haar scale>0
Compute direct Haar multiscale wavelet transform of selected images.
-ihaar scale>0
Compute inverse Haar multiscale wavelet transform of selected images.
-fft
Compute direct Fourier transform of selected images.
-ifft
Compute inverse Fourier transform of selected images.
Image creation and drawing
--------------------------
-histogram nb_levels>0[%],_valmin[%],_valmax[%]
Compute histogram of selected images.
-distance isovalue
Compute unsigned distance functions to specified isovalue.
-eikonal nb_iterations>=0,_band_size>=0
Compute signed distance functions to 0, using Eikonal PDE.
-label
Label connected components of selected images.
-displacement [indice],_smoothness>=0,_precision>0,_nbscales>=0,itermax>=0,
is_backward={0|1}
Estimate displacement field between selected images and specified source.
If '_nbscales==0', the number of used scales is automatically estimated.
-sort
Sort values of selected images in increasing order.
-psnr _maximum_value
Compute PSNR values between selected images and store them in a matrix.
-point x[%],y[%],_z[%],_opacity,_color1,..
Set specified colored pixel on selected images.
-line x0[%],y0[%],x1[%],y1[%],_opacity,_color1,..'
Draw specified colored line on selected images.
-polygon N,x1[%],y1[%],..,xN[%],yN[%],_opacity,_color1,..
Draw specified colored N-polygon on selected images.
-spline x0,y0,u0,v0,x1,y1,u1,v1,_opacity,_color1,..
Draw specified colored spline curve on selected images.
-ellipse x[%],y[%],r[%],R[%],_angle,_opacity,_color1,..
Draw specified colored ellipse on selected images.
-text text,_x[%],_y[%],_size>0,_opacity,_color1,..
Draw specified colored text string on selected images.
-image [indice],_x[%],_y[%],_z[%],_opacity,_[indice_mask]
Draw specified sprite image on selected images.
-object3d [indice],_x[%],_y[%],_z,_opacity,_is_zbuffer={0|1}
Draw specified 3D object on selected images.
-plasma alpha,_beta,_opacity
Draw a random colored plasma on selected images.
-mandelbrot z0r,z0i,z1r,z1i,_itermax>=0,_is_julia={0|1},_c0r,_c0i,_opacity
Draw Mandelbrot/Julia fractals on selected images.
-quiver [indice],_sampling>0,_factor,_quiver_type={0|1},_opacity,_color1,..
Draw a 2D vector field on selected images.
-flood x[%],_y[%],_z[%],_tolerance>=0,_opacity,_color1,..
Flood-fill selected images using specified fill value and tolerance.
List manipulation
-----------------
-remove
Remove selected images from the list.
(eq. to '-rm').
-keep
Keep only selected images in the list.
(eq. to '-k').
-move position
Move selected images at specified position in the list.
(eq. to '-mv').
-reverse
Reverse position order of selected images.
-name [indice] |
name
Set name of selected images.
The specified name is either the one from another image or from the specified 'name'.
3D rendering
------------
-line3d x0,y0,z0,x1,y1,z1
Insert a 3D line object at the end of the list.
-triangle3d x0,y0,z0,x1,y1,z1,x2,y2,z2
Insert a 3D triangle object at the end of the list.
-quadrangle3d x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3
Insert a 3D quadrangle object at the end of the list.
-box3d size |
size_x,size_y,size_z
Insert a 3D box object at the end of the list.
-cone3d radius,_size_z,_subdivisions>0
Insert a 3D cone object at the end of the list.
-cylinder3d radius,_height,_subdivisions>0
Insert a 3D cylinder object at the end of the list.
-torus3d radius1,_radius2,_subdivisions1>0,_subdivisions2>0
Insert a 3D torus object at the end of the list.
-plane3d size1_size2,_subdivisions1>0,_subdisivions2>0
Insert a 3D plane object at the end of the list.
-sphere3d radius,_recursions>=0
Insert a 3D sphere object at the end of the list.
-elevation3d z-factor |
[indice] |
'formula',_x0,_y0,_x1,y1,_dx[%],_dy[%] |
(no args)
Compute 3D elevation of selected images with specified elevation map.
If a 'z-factor' is specified, the elevation maps are given by the norm of the
selected images themselves. Else, elevation values are taken from the image
[indice] or from the specified mathematical expression 'formula'.
-isoline3d isovalue[%] |
'formula',value,_x0,_y0,_x1,_y1,_dx>0[%],_dy>0[%]
Compute 3D isoline from selected images or from specified mathematical expression.
-isosurface3d isovalue[%] |
'formula',value,_x0,_y0,_z0,_x1,_y1,_z1,_dx>0[%],_dy>0[%],_dz>0[%]
Compute 3D isosurfaces from selected images or from specified mathematical expression.
-streamline3d x,y,z,_L>=0,_dl>0,_interpolation,_is_backward={0|1},_is_oriented={0|1} |
'formula',x,y,z,_L>=0,_dl>0,_interpolation,_is_backward={0|1},_is_oriented={0|1}
Compute 3D streamlines from selected vector fields or from specified mathematical expression.
'interpolation' can be { 0=nearest integer, 1=1st-order, 2=2nd-order, 3=4th-order }.
-add3d tx,_ty,_tz |
[indice] |
(noargs)
Shift selected 3D objects with specified translation vector, or merge them
with 3D object [indice], or merge selected 3D objects together.
(eq. to '-+3d').
-add3d tx,_ty,_tz
Shift selected 3D objects with the opposite of specified translation vector.
(eq. to '--3d').
-mul3d factor |
factor_x,factor_y,_factor_z
Scale selected 3D objects isotropically or anisotropically, with specified factors.
(eq. to '-*3d').
-div3d factor |
factor_x,factor_y,_factor_z
Scale selected 3D objects isotropically or anisotropically, with the inverse of
specified factors.
(eq. to '-/3d').
-center3d
Center positions of selected 3D objects.
(eq. to '-c3d').
-normalize3d
Normalize selected 3D objects to unit size.
(eq. to '-n3d').
-rotate3d u,v,w,angle
Rotate selected 3D objects around axis (u,v,w) with specified angle (in degree.).
(eq. to '-rot3d').
-color3d R,G,B,_opacity
Set color and opacity of selected 3D objects.
(eq. to '-col3d').
-opacity3d opacity
Set opacity of selected 3D objects.
(eq. to '-o3d').
-reverse3d
Invert primitive orientations of selected 3D objects.
(eq. to '-r3d').
-primitives3d mode
Set specified primitive mode for selected 3D objects.
(eq. to '-p3d').
'mode' can be { 0=points | 1=segments }.
-split3d
Split selected 3D objects data into 6 1-column data images :
'header', '(nb_vertices,nb_primitives)', 'vertices', 'primitives', 'colors', 'opacities' ].
(eq. to '-s3d').
-light3d position_x,position_y,position_z
Set position of the light for 3D rendering.
(eq. to '-l3d').
-focale3d focale
Set focale value for 3D rendering.
(eq. to '-f3d').
-specl3d value
Set amount of specular light for 3D rendering.
(eq. to '-sl3d').
-specs3d value
Set shininess of specular light for 3D rendering.
(eq. to '-ss3d').
-double3d mode={0|1}
Set/unset double-sided mode for 3D rendering.
(eq. to '-db3d').
-render3d mode
Set static 3D rendering mode.
(eq. to '-m3d').
'mode' can be { -1=bounding-box | 0=pointwise | 1=linear | 2=flat | 3=flat-shaded |
4=gouraud-shaded | 5=phong-shaded }.
-renderd3d mode
Set dynamic 3D rendering mode.
(eq. to '-md3d').
'mode' can be { -1=bounding-box | 0=pointwise | 1=linear | 2=flat | 3=flat-shaded |
4=gouraud-shaded | 5=phong-shaded }.
-background3d R,_G,_B
Define background color in 3D viewer.
(eq. to '-b3d').
Program controls
----------------
-nop
Do nothing.
-skip item
Do nothing but skip specified item.
-return
Return from current command scope.
-exec command
Execute external command, using a system call.
-do
Start a 'do..while' code bloc.
-while condition
End a 'do..while' code bloc and go back to associated '-do'
if specified 'condition' is verified.
'condition' must be a number standing for { 0=false | other=true }.
-if condition
Start a 'if..elif..else..endif' code bloc and test
if specified 'condition' is verified.
'condition' must be a number standing for { 0=false | other=true }.
-elif condition
Start a 'elif..else..endif' code bloc if previous '-if' was not verified
and test if 'condition' is verified.
-else
Execute following commands if previous '-if' or '-elif' conditions failed.
-endif
End a 'if..elif..else..endif' code bloc.
-repeat number
Start 'number' iterations of a 'repeat..done' code loop.
-done
End a 'repeat..done' code loop, and go to associated '-repeat' if iterations remain.
-check condition
Check 'condition', and quit interpreter if not verified.
-quit
Quit interpreter.
(eq. to '-q').
-push item
Push 'item' on the global stack at selected positions.
(eq. to '-p').
Specified selection (if any) for this command stands for stack indices, not image indices.
-pushr item
Replace 'item' on the global stack at (existing) selected positions.
(eq. to '-pr').
Specified selection (if any) for this command stands for stack indices, not image indices.
-pop
Pop items from the global stack at selected positions.
(eq. to '-pp').
Specified selection (if any) for this command stands for stack indices, not image indices.
-local
Start a local environment with the selected images.
(eq. to '-l').
-endlocal
End the previous local environment.
(eq. to '-endl').
-patch size_x,_size_y,_size_z,_size_v,borders
Enable patch processing environment with the selected images.
-endpatch
End the previous patch processing environment.
(eq. to '-endp').
-print
Print informations on selected images.
-echo message
Output specified message on the standard output.
(eq. to '-e').
-error message
Print error message, and quit interpreter.
-warning message
Print warning message.
-progress 0<=value<=100 |
-1
Set the progression state of the current process.
It is useful only when the G'MIC interpreter is used in an embedding application.
Input/output
------------
-input filename |
{ width>0[%] | [indw] },{ _height>0[%] | [indh] },{ _depth>0[%] | [indd] },
{ _spectrum>0[%] | [inds] },_value1,.. |
[indice]x_nb_copies>0 |
(value1{,|;|/|^}value2{,|;|/|^}..)
Insert new image from a filename or from a copy of an existing image ['indice'],
or insert new image with specified values.
(eq. to '-i' | (no args)).
-output filename,_format_specific_options
Output selected images into one or several filenames.
(eq. to '-o').
-display
Display selected images with an interactive viewer.
(eq. to '-d').
-display3d
Display selected 3D objects with an interactive viewer.
(eq. to '-d3d').
-window width>=-1,_height>=-1,_normalization,_fullscreen |
(no args)
Display selected images into an instant window of specified size and
normalization type.
(eq. to '-w').
'normalization' can be { -1=keep same | 0=none | 1=always | 2=1st-time | 3=auto }.
'fullscreen' can be { 0=no, 1=yes }.
If 'width'=0, the instant window is closed. If width=-1, it is resized
to its current GUI-window size. You can also manage up to 10 different instant windows
by using the commands '-w0' (eq. to '-w'),'-w1',..,'-w9'.
-wait delay
(no args)
Wait a given delay or wait for any event from the instant window.
'delay' can be { <0=delay+flush | 0=event | >0=delay }.
Specified selection (if any) for this command stands for instant window indices, not image indices.
-plot _plot_type,_vertex_type,_xmin,_xmax,_ymin,_ymax |
'formula',_xmin,xmax,_ymin,_ymax,_resolution,_plot_type,_vertex_type
Display image or mathematical expression with an interactive viewer.
'plot_type' can be { 0=none | 1=lines | 2=splines | 3=bar }.
'vertex_type' can be { 0=none | 1=points | 2|3=crosses | 4|5=circles | 6|7=squares }.
-select feature
Interactively select a feature from selected images.
'feature' can be { 0=point | 1=segment | 2=rectangle | 3=ellipse }.
If the instant display window [0] is active, it is used for the selection.
Commands : Default custom commands
----------------------------------
-gradient_norm
Compute gradient norm of selected images.
-gradient_orientation _dimension={1,2,3}
Compute N-D gradient orientation of selected images.
-gradient2rgb _orientation={0|1}
Compute RGB representation of 2D gradient of selected images.
-laplacian
Compute Laplacian of selected images.
-gradient_2derivative
Compute gradient-directed 2nd derivative of image(s).
-dog _sigma1>=0[%],_sigma2>=0[%]
Compute difference of gaussian on selected images.
-curvature
Compute isophote curvatures on selected images.
-histogram_cumul _nb_levels>0,_is_normalized={0|1}
Compute cumulative histogram of selected images.
-transfer_histogram
Transfer histogram of the last selected image to the other ones.
-complex2polar
Compute complex to polar transforms of selected images.
-polar2complex
Compute polar to complex transforms of selected images.
-split_freq smoothness>0[%]
Split selected images into low and high frequency parts.
-compose_freq
Compose selected low and high frequency parts into new images.
-direction2rgb
Compute RGB representation of selected 2D direction fields.
-normalize_sum
Normalize selected images with a unitary sum.
-normalize_local _amplitude>=0,_radius>0,_n_smooth>=0[%],_a_smooth>=0[%],_cut={0|1},_min=0,_max=255
Normalize selected images locally.
-convolve_fft
Convolve selected images two-by-two through Fourier transforms.
-deconvolve_fft
Deconvolve selected images two-by-two through Fourier transforms.
-bandpass _min_freq[%],_max_freq[%]
Apply bandpass filter to selected images.
-to_tensors
Convert selected vector fields to corresponding diffusion tensor fields.
-display_fft
Display Fourier transform of selected images, with centered log-module and argument (eq. to '-dfft').
-display_rgba
Render selected RGBA images over a checkerboard background (eq. to '-drgba').
-apply "command"
Apply specified command on selected image list.
-apply_channels "command",_channels={All,RGBA,RGB,Y,CbCr,Cb,Cr,L,ab,a,b,H,S,V,K,A},_normalize={0=cut|1=normalize}
Apply specified command on chosen normalized channels of each selected images.
-resize2dx width>0,_interpolation_type={0,1,2,3,4,5}
Resize selected images along the X-axis, preserving 2D ratio (eq. to '-r2dx').
-resize3dx width>0,_interpolation_type={0,1,2,3,4,5}
Resize selected images along the X-axis, preserving 3D ratio (eq. to '-r3dx').
-resize2dy height>0,_interpolation_type={0,1,2,3,4,5}
Resize selected images along the Y-axis, preserving 2D ratio (eq. to '-r2dy').
-resize3dy height>0,_interpolation_type={0,1,2,3,4,5}
Resize selected images along the Y-axis, preserving 3D ratio (eq. to '-r3dy').
-resize3dz depth>0,_interpolation_type={0,1,2,3,4,5}
Resize selected images along the Z-axis, preserving 3D ratio (eq. to '-r3dz').
-upscale_smart width,height,_depth,smoothness>=0,_anisotropy=[0,1],sharpening>=0
Upscale selected images with an edge-preserving algorithm.
-expand_x size_x>=0,_borders={0,1,2}
Expand selected images along the X-axis.
-expand_y size_y>=0,borders={0,1,2}
Expand selected images along the Y-axis.
-expand_z size_z>=0,borders={0,1,2}
Expand selected images along the Z-axis.
-shrink_x size_x>=0
Shrink selected images along the X-axis.
-shrink_y size_y>=0
Shrink selected images along the Y-axis.
-shrink_z size_z>=0
Shrink selected images along the Z-axis.
-array _M>0,_N>0,_expand_type={0,1,2}
Create MxN array from selected images.
-array_fade _M>0,_N>0,0<=_fade_start<=100,0<=_fade_end<=100,_expand_type={0,1,2}
Create MxN array from selected images.
-array_mirror _N>=0,_dir={0,1,2},_expand_type={0|1}
Create 2^Nx2^N array from selected images.
-array_random _Ms>0,_Ns>0,_Md>0,_Nd>0
Create MdxNd array of tiles from selected MsxNs source arrays.
-taquin _M>0,_N>0
Create MxN taquin puzzle from selected images.
-grid _M>0,_N>0
Create MxN image grid from selected images.
-frame _size_x>=0,_size_y>=0,_R,_G,_B,_A
Insert RGBA-colored frame in selected images.
-frame_fuzzy _size_x>=0,_size_y>=0,_fuzzyness>=0,_smoothness>=0,_R,_G,_B,_A
Draw RGBA-colored fuzzy frame in selected images.
-frame_round _sharpness>0,_size>=0,_smoothness,_R,_G,_B,_A
Draw RGBA-colored round frame in selected images.
-polaroid _size1>=0,_size2>=0
Create polaroid effect in selected images.
-drop_shadow _offset_x,_offset_y,_smoothness,_expansion
Drop shadow behind selected images.
-split_tiles M!=0,_N!=0,_is_homogeneous={0|1}
Split selected images as a MxN array of tiles.
-append_tiles M>0,_N>0
Append MxN selected tiles as a new image.
-rotate_tiles _angle,_M>0,N>0
Apply MxN tiled-rotation effect on selected images.
-shift_tiles _M>0,_N>0,_amplitude
Apply MxN tiled-shift effect on selected images.
-rgb2bayer _start_pattern=0,_color=0
Transform selected color images to RGB-Bayer sampled images.
-bayer2rgb _GM_smoothness,_RB_smoothness1,_RB_smoothness2
Transform selected RGB-Bayer sampled images to color images.
-warp_perspective _x-angle,_y-angle,_zoom>0,_x-center,_y-center,_borders={0,1,2}
Warp selected images with perspective deformation.
-array_pattern _M>0,_N>0,_density>=0,_angle>=0,_zoom>=0,_opacity,_expand_type={0,1,2}
Create random MxN array from selected images.
-elevate _depth,_is_plain,_is_colored
Elevate selected 2D images into 3D volumes.
-spread _dx>=0,_dy>=0,_dz>=0
Spread pixel values of selected images randomly along x,y and z.
-euclidean2polar _cx,_cx,_n>0,_borders={0,1,2}
Apply euclidean to polar transform on selected images.
-polar2euclidean _cx,_cy,_n>0,_borders={0,1,2}
Apply polar to euclidean transform on selected images.
-water _amplitude>=0,_smoothness>=0
Apply water deformation on selected images.
-wave _amplitude>=0,_frequency>=0,_center_x,_center_y
Apply wave deformation on selected images.
-twirl _amplitude,_cx,_cy,_borders={0,1,2}
Apply twirl deformation on selected images.
-flower _amplitude,_frequency,_offset_r[%],_angle,_cx,_cy,_borders={0,1,2}
Apply flower deformation on selected images.
-blur_x _amplitude,_borders={0|1}
Blur selected images along the X-axis.
-blur_y _amplitude,_borders={0|1}
Blur selected images along the Y-axis.
-blur_z _amplitude,_borders={0|1}
Blur selected images along the Z-axis.
-blur_angular _amplitude,_cx,_cy
Apply angular blur on selected images.
-blur_radial _amplitude,_cx,_cy
Apply radial blur on selected images.
-blur_linear _amplitude1,_amplitude2,_angle=0,_borders={0|1}
Apply linear blur on selected images, with specified angle and amplitudes.
-pde_flow _nb_iter>=0,_dt,_velocity_command,_sequence_flag={0|1}
Apply iterations of a generic PDE flow on selected images.
-heat_flow _nb_iter>=0,_dt,_sequence_flag={0|1}
Apply iterations of the heat flow on selected images.
-meancurvature_flow _nb_iter>=0,_dt,_sequence_flag={0|1}
Apply iterations of the mean curvature flow on selected images.
-tv_flow _nb_iter>=0,_dt,_sequence_flag={0|1}
Apply iterations of the total variation flow on selected images.
-inpaint_flow _nb_iter1>=0,_nb_iter2>=0,_dt>=0,_alpha,_sigma
Apply iteration of the inpainting flow on selected images.
-noise_hurl _amplitude>=0
Add hurl noise to selected images.
-pixelize _scale_x>0,_scale_y>0,_scale_z>0
Pixelize selected images with specified scales.
-deform _amplitude>=0
Apply random smooth deformation on selected images.
-puzzle _scale>=0
Apply puzzle effect on selected images.
-fish_eye _x,_y,0<=_radius<=100,_amplitude>=0
Apply fish-eye deformation on selected images.
-transform_polar "expr_radius",_"expr_angle",_x_center,_y_center,_borders={0|1}
Apply user-defined transform on polar representation of selected images.
-shade_stripes _frequency>=0,_direction={0|1},_darkness>=0,_lightness>=0
Add shade stripes to selected images.
-stripes_y _frequency>=0
Add vertical stripes to selected images.
-tetris _scale>0
Apply tetris effect on selected images.
-damp_patch _opacity>=0
Add damp patches to selected images.
-light_patch _density>0,_darkness>=0,_lightness>=0
Add light patches to selected images.
-kaleidoscope _cx,_cy,_radius,_angle,_borders={0,1,2}
Create kaleidoscope effect from selected images.
-mosaic _density>=0,_amplitude,_relief={0|1}
Add random mosaic pattern to selected images.
-sponge _size>0
Apply sponge effect on selected images.
-hearts _density>=0
Apply heart effect on selected images.
-color_ellipses _count>0,_radius>=0,_opacity>=0
Add random color ellipses to selected images.
-whirls _texture>=0,_smoothness>=0,_darkness>=0,_lightness>=0
Add random whirl texture to selected images.
-edges _threshold>=0
Estimate contours of selected images.
-isophotes _nb_levels>0
Render isophotes of selected images on a transparent background.
-topographic_map _nb_levels>0,_smoothness
Render selected images as topographic maps.
-cartoon _smoothness,_sharpening,_threshold>=0,_thickness>=0,_color>=0,quantization>0
Apply cartoon effect on selected images.
-drawing _amplitude>=0
Apply drawing effect on selected images.
-draw_whirl _amplitude>=0
Apply whirl drawing effect on selected images.
-paper_texture
Add paper texture to selected images.
-stencilbw _edges>=0,_smoothness>=0
Apply B&W stencil effect on selected images.
-pencilbw _size>=0,_amplitude>=0
Apply B&W pencil effect on selected images.
-ditheredbw
Create dithered B&W version of selected images.
-dotsbw
Apply B&W dots effect on selected images.
-warhol _M>0,_N>0,_smoothness>=0,_color>=0
Create MxN Andy Warhol-like artwork from selected images.
-cubism _nb_iter>=0,_bloc_size>0,_max_angle,_opacity,_smoothness>=0
Apply cubism effect on selected images.
-glow _amplitude>=0
Add soft glow on selected images.
-old_photo
Apply old photo effect on selected images.
-lic _amplitude>0,_channels>0
Generate LIC representation of vector field.
-to_gray
Force selected images to be in GRAY mode.
-to_graya
Force selected images to be in GRAYA mode.
-to_rgb
Force selected images to be in RGB mode.
-to_rgba
Force selected images to be in RGBA mode.
-to_colormode mode={0=unchanged,1=G,2=GA,3=RGB,4=RGBA}
Force selected images to be in a given color mode.
-remove_opacity
Remove opacity channel of selected images.
-select_color _tolerance[%]>=0,col1,...,colN
Select pixels with specified color in selected images.
-replace_color _tolerance[%]>=0,_smoothness[%]>=0,src1,...,srcN,dest1,...,destN
Replace pixels from/to specified colors in selected images.
-fill_color col1,...,colN
Fill selected images with specified color.
-luminance
Compute luminance of selected images.
-mix_rgb a11,a12,a13,a21,a22,a23,a31,a32,a33
Apply 3x3 specified matrix to RGB colors of selected images.
-apply_gamma gamma
Apply gamma correction to selected images.
-solarize
Solarize selected images.
-sepia
Apply sepia tones effect on selected images.
-negative
Compute negative of selected images.
-tones N>0
Get N tones masks from selected images.
-split_opacity
Split color and opacity parts of selected images.
-red_eye 0<=_threshold<=100,_smoothness>=0,0<=attenuation<=1
Attenuate red-eye effect in selected images.
-threshold2 _min,_max
Threshold selected images between the two given values.
(eq. to '-t2').
-fade_x 0<=_start<=100,0<=_end<=100
Create horizontal fading from selected images.
-fade_y 0<=_start<=100,0<=_end<=100
Create vertical fading from selected images.
-fade_z 0<=_start<=100,0<=_end<=100
Create transversal fading from selected images.
-fade_radial 0<=_start<=100,0<=_end<=100
Create radial fading from selected images.
-fade_diamond 0<=_start<=100,0<=_end<=100
Create diamond fading from selected images.
-fade_linear _angle,0<=_start<=100,0<=_end<=100
Create linear fading from selected images.
-compose_rgba
Compose selected RGBA images two-by-two, over RGB background.
-compose_average
Compose selected images two-by-two, using average mode.
-compose_multiply
Compose selected images two-by-two, using multiply mode.
-compose_screen
Compose selected images two-by-two, using screen mode.
-compose_darken
Compose selected images two-by-two, using darken mode.
-compose_lighten
Compose selected images two-by-two, using lighten mode.
-compose_difference
Compose selected images two-by-two, using difference mode.
-compose_negation
Compose selected images two-by-two, using negation mode.
-compose_exclusion
Compose selected images two-by-two, using exclusion mode.
-compose_overlay
Compose selected images two-by-two, using overlay mode.
-compose_hardlight
Compose selected images two-by-two, using hard light mode.
-compose_softlight
Compose selected images two-by-two, using soft light mode.
-compose_dodge
Compose selected images two-by-two, using dodge mode.
-compose_colorburn
Compose selected images two-by-two, using color burn mode.
-compose_reflect
Compose selected images two-by-two, using reflect mode.
-compose_freeze
Compose selected images two-by-two, using freeze mode.
-compose_stamp
Compose selected images two-by-two, using stamp mode.
-compose_interpolation
Compose selected images two-by-two, using interpolation mode.
-compose_xor
Compose selected images two-by-two, using xor mode.
-compose_edges smoothness=0.8
Compose selected images togethers using edge composition.
-cross_correlation
Compute cross-correlation using two-by-two selected images.
-normalized_cross_correlation
Compute normalized cross-correlation using two-by-two selected images.
-phase_correlation
Estimate translation vector using two-by-two selected images.
-morph nb_frames>0,_smoothness>=0,_precision>0
Create morphing sequence between selected images.
-register_nonrigid _smoothness>=0,_precision>0,_nb_scale>=0
Register selected images with non-rigid warp.
-register_rigid _smoothness>=0
Register selected images with rigid warp.
-deinterlace _method={0|1}
Deinterlace selected images ('method' can be { 0=standard or 1=motion-compensated }).
-animate3d _width>0,_height>0,_dx,_dy,_dz
Animate selected 3D objects in a window.
-imagecube3d _resolution>0
Create 3D mapped cubes from selected images.
-text3d "text",_size>0,_depth>0,_smoothness
Create a 3D text object from specified text.
-gmic3d
Create a 3D gmic logo.
-animate filter_name,(params_start;..;..),(params_end;..;..),nb_frames>=0,_output_frames={0|1},_output_files={0|1},_filename
Animate filter from starting parameters to ending parameters.
-x_mandelbrot _julia={0|1},_c0r,_c0i
Launch Mandelbrot/Julia explorer.
-x_fish_eye
Launch fish-eye demo.
-x_spline
Launch spline curve ditor.
-factorial N
Print the factorial of the integer 'N'.
-strcmp string1,string2
Compare two strings and push resulting boolean on the global stack.
Viewers shortcuts
-----------------
The following shortcuts are available for the viewers of images or 3D objects :
- CTRL+D : Increase window size.
- CTRL+C : Decrease window size.
- CTRL+R : Reset window to its initial size.
- CTRL+F : Toggle fullscreen mode.
- CTRL+S : Save current window snapshot.
- CTRL+O : Save current instance of viewed image (or 3D object).
Special shortcuts for the viewer of 2D/3D images are :
- CTRL+P : Play stack of 3D frames as a movie.
- CTRL+(mousewheel) : Zoom in/out.
- SHIFT+(mousewheel) : Go left/right.
- ALT+(mousewheel) : Go up/down.
- Numeric PAD : Zoom in/out (+/-) and move zoomed region (digits).
- BACKSPACE : Reset zoom to its initial scale.
Special shortcuts for the viewer of 3D objects are :
- (mouse)+(left mouse button) : Rotate object.
- (mouse)+(right mouse button) : Zoom object.
- (mouse)+(middle mouse button) : Shift object.
- (mousewheel) : Zoom in/out.
- CTRL+F1 ... CTRL+F6 : Swap between rendering modes.
- CTRL+Z : Enable/disable Z-buffer.
- CTRL+A : Show/hide 3D axes.
- CTRL+T : Enable/disable double-sided triangles.
File options
------------
'gmic' is able to read/write most of the classical image file formats, including :
- 2D grayscale/color images : PNG, JPEG, GIF, PNM, TIFF, BMP, ..
- 3D volumetric images : DICOM, HDR, NII, PAN, CIMG, INR, ..
- Video files : MPEG, AVI, MOV, OGG, FLV, ..
- Generic data files : DLM, ASC, RAW, TXT.
- 3D objects : OFF.
Specific file format options :
- For video files : you can read only sub-frames of the sequence with
'video.ext,[first_frame[%][,last_frame[%][,step]]]'.
- For RAW binary files : you must specify image dimensions with
'file.raw,width[,height[,depth[,dim]]]]'.
- For YUV files : you must specify the image dimensions and can read only sub-frames
of the image sequence with
'file.yuv,width,height[,first_frame[,last_frame[,step]]]'.
- For JPEG files : you can specify the quality (in %) of an output jpeg file with
'file.jpg,30%'.
- If an input file has extension '.gmic', it is read as a G'MIC custom command file.
Mathematical expressions
------------------------
Some G'MIC commands may take a 'formula' as an argument. Actually, G'MIC has a simple
but useful parser of mathematical expressions. This parser is able to understand the
following functions, operators and variable names :
- Variables 'x','y','z','c' returns the current pixel coordinates of an associated
image, if any (else, their are equal to '0').
- Variables 'w','h','d','s' return the associated image dimensions (if any).
- Variable 'i' return the current pixel value of the associated image (if any),
at coordinates (x,y,z,c).
- Using 'i' as a function 'i(X,_Y,_Z,_C,_borders)' is possible. It returns
the pixel value at another location (X,_Y,_Z,_C) of the associated image.
- Variable '?' (or 'u') and 'g' returns random values following respectively
uniform or gaussian distributions.
- Using '?' (or 'u') as a function '?(min,max)' is possible. It returns
a random number in specified value range [min,max].
- Variables 'pi' and 'e' are replaced by their classical values (3.14.. and 2.71..).
- Most of the classical arithmetic and logical operators can be used, as well as
usual mathematical functions (same syntax as in C).
- Function 'if(condition,action,action_else)' can be used for conditional tests.
- User-defined variables can be assigned and re-used inside a mathematical
expression, using the '=' operator. Variable names are case-sensitive.
- Separators ';' can be used to separate multiple variable definitions.
- When using separators ';', only the evaluation of the last expression is returned.
Examples of use
---------------
'gmic' is a simple but quite complete interpreter of image processing commands
and can be used in a wide variety of situations for various image processing tasks.
Here are few examples of possible applications :
- View images :
gmic file1.bmp file2.jpeg
- Convert image file :
gmic input.bmp -o output.jpg
- Create volumetric image from a movie sequence :
gmic input.mpg -a z -o output.hdr
- Compute image gradient norm :
gmic input.bmp -gradient_norm
- Denoise a color image :
gmic image.jpg -denoise 30,10 -o denoised.jpg
- Compose two images using overlay :
gmic image1.jpg image2.jpg -compose_overlay -o composed.jpg
- Evaluate a mathematical expression :
gmic -e "cos(pi/4)^2+sin(pi/4)^2={cos(pi/4)^2+sin(pi/4)^2}"
- Plot a 2D function :
gmic 1000,1,1,2 -f "X=3*(x-500)/500;X^2*sin(3*X^2)+if(c==0,u(0,-1),cos(X*10))" -plot
- Plot a 3D elevated function in random colors:
gmic 128,128,1,3,"?(0,255)" -plasma 10,3 -blur 4 -sharpen 10000 \
128,128,1,1,"X=(x-64)/6;Y=(y-64)/6;100*exp(-(X^2+Y^2)/30)*abs(cos(X)*sin(Y))"\
-elevation3d[-2] [-1]
- Plot the isosurface of a 3D volume :
gmic -m3d 5 -md3d 5 -db3d 0 -isosurface3d "'x^2+y^2+abs(z)^abs(4*cos(x*y*z*3))'",3
- Create a G'MIC 3D logo :
gmic 180,70,1,3 -text G\'MIC,30,5,50,1,1 -blur 2 -n 0,100 --plasma 0.4 -+ \
-blur 1 -elevation3d -0.1 -md3d 4
- Create a 3D ring of torii :
gmic -repeat 20 -torus3d 15,2 -col3d[-1] "{?(60,255)},{?(60,255)},{?(60,255)}" \
-*3d[-1] 0.5,1 -if "{@{>,-1}%2}" -rot3d[-1] 0,1,0,90 -endif -+3d[-1] 70 -+3d \
-rot3d 0,0,1,18 -done -md3d 3 -m3d 5 -db3d 0
- Create a vase from a 3D isosurface :
gmic -md3d 4 -isosurface3d "'x^2+2*abs(y/2)*sin(2*y)^2+z^2-3',0" -sphere3d 1.5 --3d[-1] 0,5 \
-plane3d 15,15 -rot3d[-1] 1,0,0,90 -c3d[-1] -+3d[-1] 0,3.2 -col3d[-1] 180,150,255 \
-col3d[-2] 128,255,0 -col3d[-3] 255,128,0 -+3d
See also the command file 'gmic_def.raw' for more examples of G'MIC commands.
** G'MIC comes with ABSOLUTELY NO WARRANTY; for details visit http://gmic.sourceforge.net **