G'MIC(1)

NAME

gmic - manage generic image processing operations, through the G'MIC language interpreter.

HELP

gmic : GREYC's Magic Image Converter (Jul 29 2010, 19:13:41).
Version 1.3.9.0, Copyright (C) 2008-2010, David Tschumperle
(http://gmic.sourceforge.net)
Usage
-----
gmic [item1 [arg1_1,arg1_2,..]] .. [itemN [argN_1,argN_2,..]]
'gmic' is an open-source interpreter of the G'MIC language, a
script-based programming
language dedicated to the design of image processing pipelines. It
can be used to
convert, manipulate, and visualize datasets composed of one or sev
eral 1d/2d/3d
multi-spectral images.
The G'MIC language is quite minimalist. It is entirely defined by the
following rules :

** Overall context :

- At any time, G'MIC manages three lists of numbered (and optionally
labelled) items, stored
in computer memory :
_ One list of pixel-based images, each representing 1d/2d/3d scalar
or multi-spectral data.
This is actually the most important and significant dataset in
G'MIC and we will focus
mainly on it in the followings. An image may have a label asso
ciated to it.
_ One list of text strings (named 'local stack'), used to manage
local variables in G'MIC
pipelines and custom commands. A local stack element may have a
label associated to it.
Each G'MIC custom command gets its own local stack.
_ One list of display windows, which are useful objects to manage
real-time animations or
to handle user interactions. Up to 10 windows can be managed at
the same time.
A display windows cannot be labelled, but is referenced by its
number, from 0 to 9.
- The first item of a list has indice number '0' and is denoted by
'[0]'.
- Negative indices are treated in a cyclic way (i.e. '[-1]' stands
for the last item of
a list, '[-2]' the penultimate one, and so on..). Thus, in a list
of 4 items, notations
'[1]' and '[-3]' both refer to the second item.
- A labelled item is referenced by '[label]'. A label is specified
when inserting a new
image or a new local stack element.
- The G'MIC language defines a set of commands and substitution mech
anisms to create
pipelines for managing these lists of image or text data in a
flexible way.
- Created pipelines can then become a part of the G'MIC language, and
re-used afterwards,
through the definition of user-defined custom commands.
** Image definition and terminology :

- In G'MIC, an image is always stored as a 4d array of scalar-valued
pixels, whose dimensions
are respectively denoted by :
_ 'width', for the number of image columns (size along the
'x'-axis).
_ 'height', for the number of image lines (size along the
'y'-axis).
_ 'depth', for the number of image slices (size along the
'z'-axis).
The depth is equal to 1 for usual 2d color images.
_ 'spectrum', for the number of image channels (size along the
'c'-axis).
The spectrum is equal respectively to 3 and 4 for usual RGB and
RGBA color images.
- There are no limitations on the number of image slices or channels
G'MIC can handle
except the amount of available memory.
- The width, height and depth of an image are considered as 'spatial'
dimensions, while
the spectrum has a 'spectral' meaning. Thus, a 4d image in G'MIC
should preferably be
regarded as a 3d dataset of multi-spectral voxels.
- All pixel values of all images of the list have the same datatype.
It can be one of :
_ 'bool' : Value range is { 0=false | 1=true }.
_ 'uchar' : Stands for 'unsigned char'. Value range is [0,255].
This type of pixel coding is commonly used to store 8bits/chan
nels RGB[A] color images
in corresponding file formats.
_ 'char' : Value range is [-128,127].
_ 'ushort' : Stands for 'unsigned short'. Value range is [0,65535].
This type of pixel coding is commonly used to store
16bits/channels RGB[A] color images
in corresponding file formats.
_ 'short' : Value range is [-32768,32767].
_ 'uint' : Stands for 'unsigned int'. Value range is [0,2^32-1] (32
bits integers).
_ 'int' : Value range is [-2^31,2^31-1] (32 bits signed integers). _ 'float' : This type of coding is able to store pixels as 32 bits
float-valued numbers.
This is the default datatype considered in G'MIC to perform
image processing operations.
_ 'double' : This type of coding is able to store pixels as 64 bits
float-valued numbers.
- Considering pixel datatypes different than 'float' is generally
useless, except to force
the input/output of image data to be done in a prescribed binary
format. Hence, most G'MIC
image processing commands are available only for the default
'float' pixel datatype.

** Items and processing pipeline :

- In G'MIC, an image processing pipeline is described as a sequence
of items separated by
spaces ' '. Such items are interpreted and executed from the left
to the right.
For instance, the expression 'input.jpg -blur 3,0 -sharpen 10 -r
200%,200% -o output.jpg'
defines a valid sequence of 9 G'MIC items.
- A G'MIC item is a text string which stands either for a command,
command arguments,
a filename, a special input string or a local stack variable
assignment.
- When invoking 'gmic' from the command-line, any word following the
executable name is
considered as one specified G'MIC item.
- Escape characters '\' and double quotes '
containing spaces, or any other character sequences.
** Input data items :

- If a specified G'MIC item appears to be a filename, the correspond
ing image data are loaded
and inserted at the end of the image list.
- Special filenames '-' and '-.ext' stand for the standard input/out
put streams, optionally
forced to be in a specific 'ext' file format (e.g. '-.jpg' or
'-.png').
- The following special input strings can be used as G'MIC items in
order to create and
insert new images with prescribed values, at the end of the image
list :
_ '[image]' or '[image]xN' : Insert 1 or N copies of the existing
image [image].
_ 'width[%],_height[%],_depth[%],_spectrum[%],_values' :
Insert a new image with specified size and values (adding '%' to
a dimension means
'percentage of the size along the same axis, taken from the last
available image').
Any specified dimension can be also replaced by '[image]', and
is then replaced by
the size along the same axis of the existing specified image
[image].
'values' can be either a sequence of numbers separated by commas
',', or a mathematical
expression, as e.g. in the input item
'256,256,1,3,if(c==0,x,if(c==1,y,255))' which
creates a 256x256 RGB color image with a spatial shading on the
red and green channels.
_ '(v1,v2,..)' : Create a new image containing specified prescribed
values. Value separators
inside parentheses can be ',' (column separator), ';' (line
separator),
'/' (slice separator) or '^' (channel separator). For instance,
expression
'(1,2,3;4,5,6;7,8,9)' creates a 3x3 matrix (scalar image), with
values from 1 to 9.
- Special variable assignment string 'label=value' inserts a new
labelled element on the
local stack with a specified value. This actually declares a new
local variable.

** Command items and selections :

- A G'MIC item starting by '-' designates a command, most of the
time. Mainly, commands
perform image processing operations on one or several available
image(s) of the list.
- Usual commands may have two equivalent names (regular and short).
For instance,
command names '-resize' and '-r' refer to the same processing
action.
- A G'MIC command may have mandatory or optional arguments. Command
arguments must be
specified in the item next to the command name. Commas ',' are
used to separate multiple
arguments, if any required.
- The execution of a G'MIC command may be restricted only to a subset
of the image list, by
appending '[subset]' to the command name. Several combinations are
possible, such as :
_ '-com[0,1,3]' : Apply command only on images [0],[1] and
[3].
_ '-com[3-5]' : Apply command only on images [3] to [5]
(i.e, [3],[4] and [5]).
_ '-com[50%-100%]' : Apply command only on the second half of
the image list.
_ '-com[0,-4--1]' : Apply command only on the first image,
and the four latest ones.
_ '-com[0-9:3]' : Apply command only on images [0] to [9],
with a step of 3
(i.e. [0], [3], [6] and [9]).
_ '-com[0--1:2]' : Apply command only on images of the list
with even indices.
_ '-com[0,2-4,50%--1]' : Apply command on images [0],[2],[3],[4]
and on the second half
of the image list.
_ '-com[^0,1]' : Apply command on all images of the list
except the two first ones.
_ '-com[label1,label2]' : Apply command on labelled images 'label1'
and 'label2'.
- G'MIC commands invoked without '[subset]' are applied by default on
all images of the list.
- A G'MIC command starting with '--' instead of '-' does not act
'in-place' but inserts its
result as one or several new images, at the end of the image list.
** Input/output properties :

- When dealing with color images, G'MIC reads, writes and displays
data using the usual
RGB color space.
- G'MIC is able to manage 3d objects that may be read or generated by
some commands. These
objects are stored as regular one-column scalar images containing
the object data, in the
following order { header, sizes, vertices, primitives, colors,
opacities }.
These 3d object representations can be processed as any other reg
ular float-valued images.
- G'MIC is able to read/write most of the classical image file for
mats, including :
_ 2d grayscale/color files : .png, .jpeg, .gif, .pnm, .tif, .bmp,
..
_ 3d volumetric files : .dcm, .hdr, .nii, .pan, .inr, ..
_ Image sequences : .mpeg, .avi, .mov, .ogg, .flv, ..
_ Generic ascii or binary data files : .cimg, .cimgz, .dlm, .asc,
.pfm, .raw, .txt, .h.
_ 3d object files : .off.
- Classical image file formats may be not always adapted to store 3d
multi-spectral datasets,
resulting in possible loss of pixel informations. Use the .cimg
file format (or .cimgz,
its compressed version) to ensure that all data are preserved dur
ing file operations.
- Options for specific file formats :
_ For video files : Only sub-frames of an image sequence may be
loaded, using the input
expression 'video.ext,[first_frame[%][,last_frame[%][,step]]]'. Output framerate and quality can be also set by using the output
expression
'file.mpg,25,1024' (here, for a 25 fps and 1024k bitrate).
_ For .raw binary files : Image dimensions must be specified, using
the input expression
'file.raw,width[,height[,depth[,dim]]]]'.
_ For .yuv files : Image dimensions must be specified, and only
sub-frames of an image
sequence may be loaded, using the input expression
'file.yuv,width,height[,first_frame[,last_frame[,step]]]'.
_ For .jpeg files : The output quality may be specified (in %),
using the output expression
'file.jpg,30' (here, to get a 30% quality output).
_ Filenames with extension '.gmic' are read as G'MIC custom command
files.
- Note that some formats or options may be not supported by your cur
rent version of 'gmic',
depending on how compilation flags have been set for the build of
the G'MIC interpreter.

** Substitution rules :

- In G'MIC, items containing '@', '~', '&', '$' or '{}' may be sub
stituted before interpreted.
Use these expressions to get the current state of the interpreter
environment :
_ '@#' is substituted by the current number of images in the list. _ '@%' is substituted by the pid of the current process.
_ '@?' is substituted by the current type of image pixels.
_ '@^' is substituted by the current verbosity level.
_ '@/' is substituted by the current level of the command scope.
_ '@{/}' or '@{/,subset}' are substituted by the content of the
command scope, or a subset of
it. If specified subset refers to multiple scope items, they are
separated by slash '/'.
_ '@*' is substituted by the current number of items in the local
stack.
_ '@{*}' or '@{*,subset}' are substituted by the content of the
local stack, or a subset of
it. If specified subset refers to multiple stack items, they are
separated by commas ','.
_ '@>' and '@<' are equivalent. They are both substituted by the
number of nested
'repeat-done' loops that are currently running.
_ '@{>}' or '@{>,subset}' are substituted by the indice values (or
a subset of them) of the
currently running 'repeat-done' loops, expressed in the ascend
ing order, from 0 to N-1.
If specified subset refers to multiple loop indices, they appear
separated by commas ','.
_ '@{<}' or '@{<,subset}' do the same but in descending order, from
N-1 to 0.
_ '@indice' or '@{indice,feature}' are substituted by the list of
pixel values of the image
[indice], or by a specific feature (or subset) of it. Requested
'feature' can be one of
the followings :
. 'w' : image width (number of image columns).
. 'h' : image height (number of image lines).
. 'd' : image depth (number of image slices).
. 's' : image spectrum (number of image channels).
. 'wh' : image width x image height.
. 'whd' : image width x image height x image depth.
. 'whds' : image width x image height x image depth x image
spectrum.
(i.e. number of values in the specified image).
. 'r' : image shared state (1, if the pixel buffer is shared,
0 else).
. 'n' : image label or filename (if the image has been read
from a file).
. 'b' : image basename (i.e. filename without the folder path
nor extension).
. 'x' : image extension (i.e last characters after the last
'.' in the filename).
. 'f' : image folder name.
. '#' : number of image values (i.e. width x height x depth x
spectrum).
. '+' : sum of all pixel values.
. '-' : difference of all pixel values.
. '*' : product of all pixel values.
. '/' : quotient of all pixel values.
. 'm' : minimum pixel value.
. 'M' : maximum pixel value.
. 'a' : average pixel value.
. 'v' : variance of pixel values.
. 't' : text string built from the image values, regarded as
ascii codes.
. 'c' : (x,y,z,c) coordinates of the minimum value, separated
by commas ','.
. 'C' : (x,y,z,c) coordinates of the maximum value, separated
by commas ','.
. '(x,_y,_z,_c,_borders)' : pixel value at coordinates
(x,y,z,c), with specified
border conditions { 0=dirichlet | 1=neumann | 2=cyclic }.
. Any other feature is considered as a specified subset of
image values. For instance,
expression '@{-1,0-50%}' is substituted by the sequence of
numerical values coming
from the first half data of the last image, separated by
commas ','.
_ '@!' is substituted by the visibility state of the instant dis
play window [0]
(can be equal to { 0=closed | 1=visible }).
_ '@{!,feature}' or '@{!indice,feature}' is substituted by a spe
cific feature of the
instant display window [0] (or [indice], if specified). The
requested feature can be
one of the followings :
. 'w' : display width (i.e. width of the display area managed
by the window).
. 'h' : display height (i.e. height of the display area man
aged by the window).
. 'wh' : display width x display height.
. 'd' : window width (i.e. width of the window widget).
. 'e' : window height (i.e. height of the window widget).
. 'de' : window width x window height.
. 'u' : screen width (actually independent on the window
size).
.' v' : screen height (actually independent on the window
size).
. 'uv' : screen width x screen height.
. 'x' : X-coordinate of the mouse position (or -1, if outside
the display area).
. 'y' : Y-coordinate of the mouse position (or -1, if outside
the display area).
. 'b' : state of the mouse buttons { 1=left-state |
2=right-state | 4=middle-state }.
. 'o' : state of the mouse wheel.
. 'k' : decimal code of the pressed key if any, else 0.
. 'n' : current normalization type of the instant display.
. 'c' : boolean (0 or 1) telling if the instant display has
been closed recently.
. 'r' : boolean telling if the instant display has been
resized recently.
. 'm' : boolean telling if the instant display has been moved
recently.
. Any other feature stands for a keycode name in capital let
ter, and is substituted by
a boolean describing the current key state { 0=pressed |
1=released }.
_ '@{
specified command line (see command '-status'). Expression '@{}'
stands thus for the
current status value.
- '~>' and '~<' are shortcuts respectively for '@{>,-1}' and
'@{<,-1}'. They refer to the
increasing/decreasing indice of the latest (currently) running
'repeat..done' loop.
- '~ind' and '~{ind}' are shortcuts for '@{*,ind}' where 'ind' is an
integer.
Use them to get the string value of one numbered item [indice]
from the local stack.
- '~label' and '~{label}' refer both to the stack element with the
specified label.
- '&ind' and '&{ind}' are both substituted by the label of the stack
element [indice].
- '&label' and '&{label}' are both substituted by the indice of the
local stack element or the
image with specified 'label' (local stack being prioritary). A
label is initially set when
inserting a new stack element (with commands '-p[label]' or
'label=value') or a new image
(with commands '-i[label]').
A labelled insertion is always done at the very end of the local
stack or image list.
- $var and '${var}' are both substituted by the value of the speci
fied variable taken from the
local stack or as the corresponding OS environment variable (local
stack being prioritary).
- Any other expression inside braces (as in '{expression}') is con
sidered as a mathematical
expression, and is evaluated, except when expression starts and
ends by simple quotes,
in which case, it is substituted by the sequence of ascii codes
that composes the specified
string, separated by commas ','.
For instance, item '{3+2}' is substituted by '5', and item
'{'foo'}' by '102,111,111'.
- The last image of the list is always associated to the evaluations
of '{expressions}',
e.g. G'MIC sequence '256,128 -fill {w}' will create a 256x128
image filled with value 256.
- Item substitution is never done in double-quoted items. One must
break double quotes if
substitution is needed, as eg. in
substitutions in considered expressions.
- One can also disable the substitution mechanism outside dou
ble-quoted items, by escaping
the '@','{','}','&','$' and '~' characters, e.g. as in
'3+4 doesn't evaluate'.

** Mathematical expressions :

- G'MIC has an embedded mathematical parser. It is used to evaluate
formulas inside braces '{}'
as well as in commands that may take formulas as arguments (e.g.
'-fill').
- When used in commands, a formula is evaluated for each pixel of the
selected images.
- The parser understands the following set of functions, operators
and variables :
_ Usual operators : || (logical or), && (logical and), | (bitwise
or), & (bitwise and),
!=, ==, <=, >=, <, >, << (left bitwise shift), >> (right bitwise
shift), -, +, *, /,
% (modulo), ^ (power), ! (logical not), ~ (bitwise not).
_ Usual functions : sin(), cos(), tan(), asin(), acos(), atan(),
sinh(), cosh(), tanh(),
log10(), log(), exp(), sign(), abs(), atan2(), round(), narg(),
arg(), isval(), isnan(),
isinf(), isint(), isbool(), rol() (left bit rotation), ror()
(right bit rotation),
min(), max(), sinc(), int().
Function 'atan2()' is the version of atan() that takes two argu
ments 'y,x', as in C/C++.
Function 'narg()' returns the number of specified arguments.
Function 'arg(i,a1,..,an)' returns the ith argument ai.
Functions 'min()' and 'max()' can be called with a variable num
ber of arguments.
Functions 'isval()', 'isnan()', 'isinf()', 'isbool()' can be
used to test the type of
a given number or expression.
_ These special variable names are pre-defined. They cannot be
overloaded :
. 'w' : width of the associated image, if any (else 0).
. 'h' : height of the associated image, if any (else 0).
. 'd' : depth of the associated image, if any (else 0).
. 's' : spectrum of the associated image, if any (else 0).
. 'x' : current processed column of the associated image, if
any (else 0).
. 'y' : current processed line of the associated image, if any
(else 0).
. 'z' : current processed slice of the associated image, if
any (else 0).
. 'c' : current processed channel of the associated image, if
any (else 0).
. 'i' : current processed pixel value (i.e. value located at
(x,y,z,c)) of the
associated image, if any (else 0).
. 'im','iM','ia','iv' : Respectively the minimum, maximum,
average values and variance
of the associated image, if any (else 0).
. 'xm','ym','zm','cm' : The pixel coordinates of the minimum
value in the associated
image, if any (else 0).
. 'xM','yM','zM','cM' : The pixel coordinates of the maximum
value in the associated,
image, if any (else 0).
. 'pi' : value of pi, i.e. 3.1415926..
. 'e' : value of e, i.e. 2.71828..
. '?' or 'u' : a random value between [0,1], following an uni
form distribution.
. 'g' : a random value, following a gaussian distribution of
variance 1
(roughly in [-5,5]).
_ These special operators can be used :
. ';' : expression separator. The returned value is always the
last encountered
expression. For instance expression '1;2;pi' is evaluated
as '3.14159'.
. '=' : variable assignment. Parser variables can only refer
to numerical values.
Variable names are case-sensitive. Use this operator in
conjunction with ';' to
define complex evaluable expressions, such as
't=cos(x);3*t^2+2*t+1'.
These variables remain local to the mathematical parser and
cannot be accessed
outside the evaluated expression.
_ The following specific functions are also defined :
. 'if(expr_cond,expr_then,expr_else)' : return value of
'expr_then' or 'expr_else',
depending on the value of 'expr_cond' (0=false,
other=true). For instance,
G'MIC command '-fill if(x%10==0,255,i)' will draw blank
vertical lines on every 10th
column of an image.
. '?(max)' or '?(min,max)' : return a random value between
[0,max] or [min,max],
following an uniform distribution. 'u(max)' and
'u(min,max)' mean the same.
. 'i(a,_b,_c,_d,_borders)' : return the value of the pixel
located at position
(a,b,c,d) in the associated image, if any (else 0). Border
conditions can be
{ 0=dirichlet | 1=neumann | 2=cyclic }. Omitted coordinates
are replaced by their
default values which are respectively equal to x, y, z, c
and 0. For instance,
command '-fill 0.5*(i(x+1)-i(x-1))' will estimate the X-de
rivative of an image.

** Management of variables :

- In a G'MIC processing pipeline, management of variables is achieved
through the use of
the local stack (to store variable values), in conjunction with
the mathematical parser
(to update the variable values). For instance, a do..while loop
with a custom counter
would be typically written as : 'X=0 -do -e $X X={$X+1} -while
{$X<10}'.
- Local stack elements (or images) may have a label associated to
them. Inserting a new
labelled element at the end of the local stack is done with com
mand '-push[label] item', or
more simply by the special assignment command 'label=item'.
- Overall manipulation of the local stack is done with one of these
four commands :
_ '-push' (eq. to '-p') to insert a new element (opt. labelled) on
the local stack.
_ '-pop' (eq. to '-pp') to remove an existing element on the local
stack.
_ '-push=' (eq. to '-p=') to reassign an existing element on the
local stack.
_ 'label=value' to assign or reassign a labelled item on the local
stack.
- Accessing the content of the local stack is done either through the
'@{*,subset}',
'~ind','~label' or '$label' substituting expressions.
** Custom commands :

- Custom commands can be defined by the user, through the use of
G'MIC command files.
- A command file is a simple ascii text file, where each line starts
either by
'command_name : substitution' or 'substitution (continuation)' or
'# comment'.
- The name of a custom command may contain the characters
'a-z','A-Z','0-9' and '_'.
- Any '# comment' expression found in a custom command file is dis
carded by the G'MIC
interpreter, wherever it is located in a line.
- A default command file is already provided within the G'MIC pack
age. It is located
at 'http://gmic.sourceforge.net/gmic_def.xxxx', where 'xxxx' has
to be replaced by
the 4 digits of the current G'MIC version number. Looking at it is
a good start to learn
more on creating your own custom commands. All the commands from
this default command file
are in fact already included by default in the current version of
the G'MIC interpreter.
- The default command file located at 'http://gmic.source
forge.net/gmic_def.xxxx' may be
updated/corrected by the G'MIC developers. You can download and
include it with the
'-command' (or -'m') directive to update your default command def
initions as well.
- In custom commands, some expressions starting with '$' are substi
tuted :
_ '$#' is substituted by the maximum indice of known arguments
(either specified by the user
or set to a default value in the custom command).
_ '$?' is substituted by a string telling about the command subset
restriction (only useful
when custom commands need to output descriptive messages).
_ '$i' and '${i}' are both substituted by the i-th specified argu
ment. Negative indices
such as '$[-j}' are allowed and refer to the j^th latest argu
ment. '$0' is substituted by
the custom command name.
_ '${i=default}' is substituted by the value of $i (if defined) or
by its new default value
'default' else ('default' may be a $-expression as well).
_ '${subset}' is substituted by the arguments values (separated by
commas ',') of a specified
argument subset. For instance expression '${2--2}' is substitued
by all
specified arguments except the first and the last ones. Useful
expression '${^0}' is
substituted by all specified arguments.
- Specifying arguments may be skipped when invoking a custom command,
by replacing them by
commas ',' as in expression '-flower ,,3'. Omitted arguments are
set to their default
values, which must be thus explicitely defined in the code of the
corresponding custom
command (using default argument expressions as '${1=default}').
** Image and data viewers :

- G'MIC has some very handy embedded visualization modules, for 1d
signals (command '-plot'),
1d/2d/3d images (command '-display') and 3d objects (command
'-display3d'). They allow to
interactively view and explore the selected image datasets.
- The following keyboard shortcuts are available in the interactive
viewers :
_ CTRL+D : Increase window size.
_ CTRL+C : Decrease window size.
_ CTRL+R : Reset window size.
_ CTRL+F : Toggle fullscreen mode.
_ CTRL+S : Save current window snapshot as a numbered file
'CImg_xxxx.bmp'.
_ CTRL+O : Save current instance of the viewed data, as a numbered
file 'CImg_xxxx.cimg'.
- Shortcuts specific to the 1d/2d/3d image viewer :
_ CTRL+P : Play stack of slices as a movie (for volu
metric 3d images).
_ CTRL+(mousewheel) : Zoom in/out.
_ SHIFT+(mousewheel) : Go left/right.
_ ALT+(mousewheel) : Go up/down.
_ Numeric PAD : Zoom in/out (+/-) and move through zoomed
image (digits).
_ BACKSPACE : Reset zoom scale.
- Shortcuts specific to the 3d object viewer :
_ (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 : Set 3d rendering mode.
_ CTRL+Z : Enable/disable z-buffered render
ing.
_ CTRL+A : Show/hide 3d axes.
_ CTRL+G : Save 3d object, as a numbered
file 'CImg_xxxx.off'.
_ CTRL+T : Switch between single/dou
ble-sided modes.

** Command reference :
All recognized G'MIC commands are listed below, classified by themes. When several choices of command arguments are possible, they appear
separated by '|'.
An argument specified inside '[]' or starting by '_' is optional
except when standing for an
existing image [image], where 'image' can be either an indice number
or an image label.
In this case, the '[]' characters are mandatory when writing the item.
A command marked with
(*) is available for all image types, else only for the default
'float' pixel datatype.

Global options
--------------

-help _command (*)

Display help (optionally for specified command only) and quit. (eq. to '-h').
-debug (*)

Activate debug mode.
When activated, this mode outputs additionnal log messages
describing the
internal state of the interpreter.
Mathematical operators and functions
------------------------------------

-add value[%] |
[image] |
filename |
'formula' |
(no args)
Add specified value, image, file or mathematical expression to
selected images,
or compute the pointwise sum of selected images.
(eq. to '-+').
-sub value[%] |
[image] |
filename |
'formula' |
(no args)
Subtract specified value, image, file or mathematical expres
sion to selected images,
or compute the pointwise difference of selected images.
(eq. to '--').
-mul value[%] |
[image] |
filename |
'formula' |
(no args)
Multiply selected images by specified value, image, file or
mathematical expression,
or compute the pointwise product of selected images.
(eq. to '-*').
-mmul value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the matrix product of selected matrices/vectors by
specified value, image, file or
mathematical expression, or compute the matrix products of
selected images.
(eq. to '-**').
-div value[%] |
[image] |
filename |
'formula' |
(no args)
Divide selected image by specified value, image, file or mathe
matical expression,
or compute the pointwise quotient of selected images.
(eq. to '-/').
-pow value[%] |
[image] |
filename |
'formula' |
(no args)
Raise selected image to the power of specified value, image,
file or mathematical
expression, or compute the pointwise sequential powers of
selected images.
(eq. to '-^').
-min value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the minimum between selected images and specified
value, image, file or
mathematical expression, or compute the pointwise minima
between selected images.

-max value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the maximum between selected images and specified
value, image, file or
mathematical expression, or compute the pointwise maxima
between selected images.

-mod value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the modulo of selected images with specified value,
image, file or mathematical
expression, or compute the pointwise sequential modulo of
selected images.

-and value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise AND of selected images with specified
value, image, file or mathematical
expression, or compute the pointwise sequential bitwise AND of
selected images.

-or value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise OR of selected images with specified value,
image, file or mathematical
expression, or compute the pointwise sequential bitwise OR of
selected images.

-xor value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise XOR of selected images with specified
value, image, file or mathematical
expression, or compute the pointwise sequential bitwise XOR of
selected images.

-bsl value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise left shift of selected images with speci
fied value, image, file or
mathematical expression, or compute the pointwise sequential
bitwise left shift of
selected images.
(eq. to '-<<').
-bsr value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise right shift of selected images with speci
fied value, image, file or
mathematical expression, or compute the pointwise sequential
bitwise right shift of
selected images.
(eq. to '->>').
-rol value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise left rotation of selected images with spec
ified value, image, file or
mathematical expression, or compute the pointwise sequential
bitwise left rotation of
selected images.
-ror value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the bitwise right rotation of selected images with
specified value, image, file or
mathematical expression, or compute the pointwise sequential
bitwise right rotation of
selected images.
-eq value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the boolean equality of selected images with specified
value, image, file or
mathematical expression, or compute the boolean equality of
selected images.
(eq. to '-==').
-neq value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the boolean inequality of selected images with speci
fied value, image, file or
mathematical expression, or compute the boolean inequality of
selected images.
(eq. to '-!=').
-gt value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the boolean 'greater than' of selected images with
specified value, image, file or
mathematical expression, or compute the boolean 'greater than'
of selected images.
(eq. to '->').
-ge value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the boolean 'greater or equal than' of selected images
with specified value, image,
file or mathematical expression, or compute the boolean
'greater or equal than' of selected
images.
(eq. to '->=').
-lt value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the boolean 'less than' of selected images with speci
fied value, image, file or
mathematical expression, or compute the boolean 'less than' of
selected images.
(eq. to '-<').
-le value[%] |
[image] |
filename |
'formula' |
(no args)
Compute the boolean 'less or equl than' of selected images with
specified value, image,
file or mathematical expression, or compute the boolean 'less
or equal than' of selected
images.
(eq. to '-<=').
-cos

Compute the pointwise cosine of selected images.
-sin

Compute the pointwise sine of selected images.
-sinc

Compute the pointwise sinc function of selected images.
-tan

Compute the pointwise tangent of selected images.
-cosh

Compute the pointwise hyperbolic cosine of selected images.
-sinh

Compute the pointwise hyperbolic sine of selected images.
-tanh

Compute the pointwise hyperbolic tangent of selected images.
-acos

Compute the pointwise arc-cosine of selected images.
-asin

Compute the pointwise arc-sine of selected images.
-atan

Compute the pointwise arc-tangent of selected images.
-atan2 [image]

Compute the pointwise oriented arc-tangent of selected images. Each selected image is regarded as the y-argument of the
arc-tangent function, while the
specified image gives the corresponding x-argument.
-abs

Compute the pointwise absolute values of selected images.
-sign

Compute the pointwise sign of selected images.
-sqr

Compute the pointwise square function of selected images.
-sqrt

Compute the pointwise square root of selected images.
-exp

Compute the pointwise exponential of selected images.
-log

Compute the pointwise logarithm of selected images.
-log10

Compute the pointwise logarithm_10 of selected images.
Basic pixel manipulation
------------------------

-endian (*)

Reverse data endianness of selected images.
-set value,_x[%],_y[%],_z[%],_c[%]

Set pixel value in selected images, at specified coordinates.
(eq. to '-=').
If specified coordinates are outside the image bounds, no
action is performed.
Default values for 'x','y','z','c' are '0'.
-fill value1,_value2,.. |
[image] |
formula
Fill selected images with values read from the specified value
list, existing image
or mathematical expression.
(eq. to '-f').
-threshold value[%],_soft |
(no args)
Threshold 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 { value0[%] | [image0] },{ value1[%] | [image1] }
|
[image] |
(no args)
Cut values of selected images in specified range.
(eq. to '-c').
(noargs) runs interactive mode (uses the instant window [0] if
opened).

-normalize { value0[%] | [image0] },{ value1[%] | [image1] }
|
[image]
Linearly normalize values of selected images in specified
range.
(eq. to '-n').
-round rounding_value>=0,_rounding_type

Round values of selected images.
'rounding_type' can be { -1=backward | 0=nearest | 1=forward }.
-equalize nb_levels>0[%],_value0[%],_value1[%]

Equalize histograms of selected images.
If value range is specified, the equalization is done only for
pixels in 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 { value0[%] | [image0] },{ value1[%] | [image1] }
|
[image]
Fill selected images with random values uniformly distributed
in the specified range.

-norm

Compute the pointwise euclidean norm of vector-valued pixels in
selected images.

-orientation

Compute the pointwise orientation of vector-valued pixels in
selected images.

-map [image] |
predefined_palette
Map specified vector-valued palette to selected indexed scalar
images.
'predefined_palette' can be { 0=default | 1=rainbow | 2=cluster
}.

-index { [image] | predefined_palette },_is_dithered={ 0
| 1 },_map_palette={ 0 | 1 }

Index selected vector-valued images by specified vector-valued
palette.
'predefined_palette' can be { 0=default | 1=rainbow | 2=cluster
}.

Color base conversion
---------------------

-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.
Geometry manipulation
---------------------

-resize [image],_interpolation,_borders,_cx,_cy,_cz,_cc |
{[image_w] | width>0[%]},_{[image_h] |
height>0[%]},_{[image_d] | depth>0[%]},
_{[image_s] | spectrum>0[%]},_interpola
tion,_borders,_cx,_cy,_cz,_cc |
(noargs)
Resize selected images with specified geometry.
(eq. to '-r').
'interpolation' can be { -1=none (memory content) | 0=none |
1=nearest | 2=average |
3=linear | 4=grid | 5=bicubic |
6=lanczos }.
'borders' can be { -1=none | 0=dirichlet | 1=neumann | 2=cyclic
}.
'cx,cy,cz,cc' set the centering mode when 'interpolation=0'
(must be in [0,1]).
Their default values are '0'.
(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 |
x0[%],y0[%],x1[%],y1[%],_borders |
x0[%],y0[%],z0[%],x1[%],y1[%],z1[%],_borders |
x0[%],y0[%],z0[%],c0[%],x1[%],y1[%],z1[%],c1[%],_bor
ders |
(noargs)
Crop selected images with specified region coordinates.
'borders' can be { 0=dirichlet | 1=neumann }.
(noargs) runs interactive mode (uses the instant window [0] if
opened).

-autocrop value1,value2,..

Autocrop selected images by specified vector-valued intensity.
-channels { [image0] | c0[%] },_{ [image1] | c1[%] }

Select specified channels of selected images.
-slices { [image0] | z0[%] },_{ [image1] | z1[%] }

Select specified slices of selected images.
-lines { [image0] | y0[%] },_{ [image1] | y1[%] }

Select specified lines of selected images.
-columns { [image0] | x0[%] },_{ [image1] | x1[%] }

Select specified columns of selected images.
-rotate angle,_borders,_interpolation,_cx[%],_cy[%],_zoom

Rotate selected images with specified angle (in deg.).
'borders' can be { 0=dirichlet | 1=neumann | 2=cyclic }.
'interpolation' can be { 0=none | 1=linear | 2=bicubic }.
When rotation center ('cx','cy') is specified, the size of the
image is preserved.

-mirror axis={ x | y | z | c }

Mirror selected images along specified axis.
-shift vx[%],_vy[%],_vz[%],_vc[%],_borders

Shift selected images by specified displacement vector.
'borders' can be { 0=dirichlet | 1=neumann | 2=cyclic }.
-transpose

Transpose selected images.
-invert

Compute the inverse of the selected matrices.
-solve [image]

Solve linear system AX = B for selected B-vectors and specified
A-matrix.

-eigen

Compute the eigenvalues and eigenvectors of specified symmetric
matrices.

-dijkstra starting_node>=0,ending_node>=0

Compute minimal distances and pathes from specified adjacency
matrices by the Dijkstra algorithm.

-permute permutation

Permute selected image axes by specified permutation.
'permutation' is a combination of the character set {x|y|z|c}, e.g. 'xycz', 'cxyz', ..
-unroll axis={ x | y | z | c }

Unroll selected images along specified axis.
-split axis={ x | y | z | c },_nb_parts |
patch_x>0,_patch_y>0,_patch_z>0,_patch_v>0,borders
|
value,_keep_splitting_values={ + | - }
Split selected images along specified axis, patch or scalar
value.
(eq. to '-s').
'nb_parts' can be { 0=maximum split | >0=split in N parts |
<0=split in parts of size -N }.
'borders' can be { 0=dirichlet | 1=neumann }.
-append axis={ x | y | z | c },_alignment

Append selected images along specified axis.
(eq. to '-a').
'alignment' can be { p=left | c=center | n=right }.
-warp [image],_is_relative={ 0 | 1 },_interpolation={ 0
| 1 },_borders,_nb_frames>0

Warp selected image with specified displacement field.
'borders' can be { 0=dirichlet | 1=neumann | 2=cyclic }.
Image filtering
---------------

-deriche std_variation>=0[%],order={ 0 | 1 | 2 },axis={ x |
y | z | c },_borders

Apply Deriche recursive filter with specified standard devia
tion, order, axis and border
conditions on selected images.
'borders' can be { 0=dirichlet | 1=neumann }.
-blur std_variation>=0[%],_borders

Blur selected images by quasi-gaussian recursive filter.
'borders' can be { 0=dirichlet | 1=neumann }.
-bilateral std_variation_s>0[%],std_variation_r>0

Blur selected images by anisotropic bilateral filtering.
'borders' can be { 0=dirichlet | 1=neumann }.
-denoise std_variation_s>=0,_std_varia
tion_p>=0,_patch_size>0,_lookup_size>0,_smoothness,
_fast_approx={ 0 | 1 }
Denoise selected images by non-local patch averaging.
-smooth amplitude>=0,_sharpness>=0,_anisot
ropy,_alpha,_sigma,_dl>0,_da>0,_precision>0,
interpolation,_fast_approx={ 0 | 1 } |
nb_iterations>=0,_sharpness>=0,_anisot
ropy,_alpha,_sigma,_dt>0,0 |
[image],_amplitude>=0,_dl>0,_da>0,_preci
sion>0,_interpolation,_fast_approx={ 0 | 1 } |
[image],_nb_iters>=0,_dt>0,0
Smooth selected images anisotropically using diffusion PDE's,
with specified field of
diffusion tensors.
'anisotropy' must be in [0,1].
'interpolation' can be { 0=nearest | 1=linear | 2=runge-kutta
}.

-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 [image],_borders

Convolve selected images by specified mask.
'borders' can be { 0=dirichlet | 1=neumann }.
-correlate [image],_borders

Correlate selected images by specified mask.
'borders' can be { 0=dirichlet | 1=neumann }.
-erode size>=0' |
size_x>=0,size_y>=0,_size_z>=0 |
[image],_borders
Erode selected images by a rectangular or the specified struc
turing element.
'borders' can be { 0=dirichlet | 1=neumann }.
-dilate size>=0 |
size_x>=0,size_y>=0,size_z>=0 |
[image],_borders
Dilate selected images by a rectangular or the specified struc
turing element.
'borders' can be { 0=dirichlet | 1=neumann }.
-inpaint [image]

Inpaint selected images by specified mask.
-gradient { x | y | z }..{ x | y | z },_scheme |
(no args)
Compute the gradient components (first derivatives) of selected
images.
'scheme' can be { -1=backward | 0=centered | 1=forward |
2=sobel |
3=rotation-invariant (default) | 4=recursive
}.
(no args) compute all significant 2d/3d components.
-structuretensors _scheme

Compute the structure tensor field of selected images.
'scheme' can be { 0=centered | 1=forward-backward1 | 2=for
ward-backward2 }.

-edgetensors sharpness>=0,_anisotropy,_alpha,_sigma,is_sqrt={ 0
| 1 }

Compute the diffusion tensors of selected images for edge-pre
serving smoothing algorithms.
'anisotropy' must be in [0,1].
-hessian { xx | xy | xz | yy | yz | zz }..{ xx | xy | xz |
yy | yz | zz } |
(no args)
Compute the hessian components (second derivatives) of selected
images.
(no args) compute all significant components.
-haar scale>0

Compute the direct haar multiscale wavelet transform of
selected images.

-ihaar scale>0

Compute the inverse haar multiscale wavelet transform of
selected images.

-fft

Compute the direct fourier transform of selected images.
-ifft

Compute the inverse fourier transform of selected images.
Image creation and drawing
--------------------------

-histogram nb_levels>0[%],_val0[%],_val1[%]

Compute the histogram of selected images.
If value range is specified, the histogram is estimated only
for pixels in the specified
value range.
-distance isovalue

Compute the unsigned distance function to specified isovalue.
-eikonal nb_iterations>=0,_band_size>=0

Compute iterations of the eikonal equation (signed distance
function) on selected images.

-watershed [priority_image],_fill_lines={ 0 | 1 }

Compute the watershed transform of selected images.
-label

Label connected components in selected images.
-displacement [source_image],_smoothness>=0,_preci
sion>0,_nb_scales>=0,iteration_max>=0,
is_backward={ 0 | 1 }
Estimate displacement field between selected images and speci
fied source.
If 'nbscales'=0, the number of needed scales is estimated from
the image size.

-sort _ordering={ + | - },_axis={ x | y | z | c }

Sort pixel values of selected images.
-mse

Compute MSE (Mean-Squared Error) matrix between selected
images.

-psnr _max_value

Compute PSNR (Peak Signal-to-Noise Ratio) matrix between
selected images.

-point x[%],y[%],_z[%],_opacity,_color1,..

Set specified colored pixel on selected images.
Default color value is '0'.
-line x0[%],y0[%],x1[%],y1[%],_opacity,_pat
tern,_color1,..'

Draw specified colored line on selected images.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified.
Default color value is '0'.
-polygon N,x1[%],y1[%],..,xN[%],yN[%],_opacity,_pat
tern,_color1,..

Draw specified colored N-vertices polygon on selected images.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified. If a pattern is specified, the
polygon is
drawn outlined instead of filled.
Default color value is '0'.
-spline
x0[%],y0[%],u0[%],v0[%],x1[%],y1[%],u1[%],v1[%],_opacity,_pattern,_color1,..

Draw specified colored spline curve on selected images.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified.
Default color value is '0'.
-ellipse x[%],y[%],R[%],r[%],_angle,_opacity,_color1,..

Draw specified colored ellipse on selected images.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified. If a pattern is specified, the
ellipse is
drawn outlined instead of filled.
Default color value is '0'.
-text text,_x[%],_y[%],_font_height>0,_opac
ity,_color1,..

Draw specified colored text string on selected images.
Exact pre-defined sizes are '13','24','32' and '57'.
Default color value is '0'.
Specifying a target image with a size of 1x1x1x1 resizes it to
new
dimensions such that the image contains the entire text
string.

-graph [function_image],_plot_type,_ver
tex_type,_ymin,_ymax,_opacity,_pattern,_color1,.. |
'formula',_resolution>=0,_plot_type,_ver
tex_type,_xmin,xmax,_ymin,_ymax,_opacity,_pattern,_color1,..

Draw specified function graph on selected images.
'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 }.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified.
Default color value is '0'.
-axes x0,x1,y0,y1,_opacity,_pattern,_color1,..

Draw xy-axes on selected images.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified.
Default color value is '0'.
-grid sizex[%]>=0,sizey[%]>=0,_offsetx[%],_off
sety[%],_opacity,_pattern,_color1,..

Draw xy-grid on selected images.
'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified.
Default color value is '0'.
-quiver [function_image],_sampling>0,_factor,_is_arrow={ 0
| 1 },_opacity,_pattern,_color1,..

Draw specified 2d vector/orientation field on selected images. 'pattern' is an hexadecimal number starting with '0x' which can
be omitted
even if a color is specified.
Default color value is '0'.
-flood x[%],_y[%],_z[%],_tolerance>=0,_opacity,_color1,..

Flood-fill selected images using specified value and tolerance. Default color value is '0'.
-image [sprite],_x[%],_y[%],_z[%],_c[%],_opac
ity,_[sprite_mask]

Draw specified sprite image on selected images.
-object3d [object3d],_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,_iteration_max>=0,_is_julia={ 0 |
1 },_c0r,_c0i,_opacity

Draw mandelbrot/julia fractal on selected images.
List manipulation
-----------------

-remove (*)

Remove selected images.
(eq. to '-rm').
-keep (*)

Keep only selected images.
(eq. to '-k').
-move position[%] (*)

Move selected images at specified position.
(eq. to '-mv').
-reverse (*)

Reverse positions of selected images.
(eq. to '-rv').
-name name (*)

Set name of selected images.
(eq. to '-nm').
3d rendering
------------

-point3d x0,y0,z0

Create a new 3d point at specified coordinates.
-line3d x0,y0,z0,x1,y1,z1

Create a new 3d line at specified coordinates.
-triangle3d x0,y0,z0,x1,y1,z1,x2,y2,z2

Create a new 3d triangle at specified coordinates.
-quadrangle3d x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3

Create a new 3d quadrangle at specified coordinates.
-circle3d x0,y0,z0,radius>=0

Create a new 3d circle at specified coordinates.
-box3d size |
size_x,size_y,size_z
Create a new 3d box at (0,0,0), with specified geometry.
-cone3d radius,_size_z,_nb_subdivisions>0

Create a new 3d cone at (0,0,0), with specified geometry.
-cylinder3d radius,_height,_nb_subdivisions>0

Create a new 3d cylinder at (0,0,0), with specified geometry.
-torus3d radius1,_radius2,_nb_subdivisions1>0,_nb_subdivi
sions2>0

Create a new 3d torus at (0,0,0), with specified geometry.
-plane3d size1_size2,_nb_subdivisions1>0,_nb_subdisiv
ions2>0

Create a new 3d plane at (0,0,0), with specified geometry.
-sphere3d radius,_nb_recursions>=0

Create a new 3d sphere at (0,0,0), with specified geometry.
-elevation3d z-factor |
[image] |
'formula',_x0,_y0,_x1,y1,_dx[%],_dy[%] |
(no args)
Create 3d elevation of selected images or specified formula,
with specified elevation map.
If a z-factor is specified, each elevation map is computed as
the pointwise L2 norm of the
selected images. Else, elevation values are taken from the
specified image or formula.

-isoline3d isovalue[%] |
'formula',value,_x0,_y0,_x1,_y1,_dx>0[%],_dy>0[%]
Extract 3d isolines with specified value from selected images
or from specified formula.

-isosurface3d isovalue[%] |
'for
mula',value,_x0,_y0,_z0,_x1,_y1,_z1,_dx>0[%],_dy>0[%],_dz>0[%]

Extract 3d isosurfaces with specified value from selected
images or from specified formula.

-streamline3d x,y,z,_L>=0,_dl>0,_interp,_is_backward={ 0 | 1
},_is_oriented={ 0 | 1 } |
'formula',x,y,z,_L>=0,_dl>0,_interp,_is_backward={
0 | 1 },_is_oriented={ 0 | 1 }

Extract 3d streamlines from selected vector fields or from
specified formula.
'interp' can be { 0=nearest integer | 1=1st-order | 2=2nd-order
| 3=4th-order }.

-add3d tx,_ty,_tz |
[object3d] |
(noargs)
Shift selected 3d objects with specified displacement vector,
or merge them with specified
3d object, or merge all selected 3d objects together.
(eq. to '-+3d').
-sub3d tx,_ty,_tz

Shift selected 3d objects with the opposite of specified dis
placement 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 selected 3d objects at (0,0,0).
(eq. to '-c3d').
-normalize3d

Normalize size of selected 3d objects.
(eq. to '-n3d').
-rotate3d u,v,w,angle

Rotate selected 3d objects around specified axis with specified
angle (in deg.).
(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

Reverse orientation of selected 3d objects.
(eq. to '-rv3d').
-primitives3d mode

Convert primitives of selected 3d objects.
(eq. to '-p3d').
'mode' can be { 0=points | 1=segments | 2=no-textures }.
-split3d

Split selected 3d objects into 6 feature vectors :
{ header, sizes, vertices, primitives, colors, opacities }.
(eq. to '-s3d').
To recreate the 3d object, append these 6 images along the
y-axis.

-light3d position_x,position_y,position_z |
[image] |
(no args)
Set the light coordinates or the light texture for 3d render
ing.
(eq. to '-l3d').
(noargs) resets the 3d light to default.
-focale3d focale>=0

Set 3d focale.
(eq. to '-f3d').
Set 'focale' to 0 to enable parallel projection (instead of
perspective).

-pose3d value1,..,value16 |
(noargs)
Set the coefficients of the 3d pose matrix.
(noargs) resets the 3d pose matrix to default.
-specl3d value

Set amount of 3d specular light.
(eq. to '-sl3d').
-specs3d value

Set shininess of 3d specular light.
(eq. to '-ss3d').
-double3d is_double={ 0 | 1 }

Enable/disable double-sided mode for 3d rendering.
(eq. to '-db3d').
-mode3d 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 }.
-moded3d 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 |
[image] |
(no args)
Define background from specified color or existing image for 3d
rendering.
(eq. to '-b3d').
(no args) resets the background to default.
Program control and environment
-------------------------------

-skip item (*)

Do nothing but skip specified item.
-return (*)

Return from current custom command.
-status item | (*)
$variable
Set current status value to the specified item or from the
value of the
specified environment variable.
(eq. to '-u').
-exec command (*)

Execute external command using a system call.
The status value is then set to the error code returned by the
system call.
(eq. to '-x').
-do (*)

Start a 'do..while' block.
-while boolean | (*)
filename
End a 'do..while' block and go back to associated '-do'
if specified boolean is true or if specified filename exists.
'boolean' can be a float number standing for { 0=false |
other=true }.

-repeat nb_iterations (*)

Start iterations of a 'repeat..done' block.
-done (*)

End a 'repeat..done' block, and go to associated '-repeat'
position, if iterations remain.

-break (*)

Break current 'repeat..done' or 'do..while' block.
(eq. to '-b').
-continue (*)

Continue to next iteration of current 'repeat..done' or
'do..while' block.

-if boolean | (*)
filename
Start a 'if..[elif]..[else]..endif' block and test if specified
boolean is true,
or if specified filename exists.
'boolean' can be a float number standing for { 0=false |
other=true }.

-elif boolean | (*)
filename
Start a 'elif..[else]..endif' block if previous '-if' was not
verified
and test if specified boolean is true, or if specified filename
exists.
'boolean' can be a float number standing for { 0=false |
other=true }.

-else (*)

Execute following commands if previous '-if' or '-elif' condi
tions failed.

-endif (*)

End a 'if..[elif]..[else]..endif' block.
-local (*)

Start a 'local..endlocal' block, with selected images.
(eq. to '-l').
-endlocal (*)

End a 'local..endlocal' block.
(eq. to '-endl').
-check expression (*)

Evaluate specified expression and display an error message and
quit, if it is evaluated.
to false.
If 'expression' is not evaluable, it is regarded as a filename
and checked if it exists.

-quit (*)

Quit interpreter.
(eq. to '-q').
-push item (*)

Push specified item on the local stack at selected positions.
(eq. to '-p').
Command subset (if any) stands for stack indices instead of
image indices.
If no subset is specified, the item is pushed at the end of the
local stack.

-push= item (*)

Replace item on the local stack by specified item, at selected
positions.
(eq. to '-p=').
Command subset (if any) stands for stack indices instead of
image indices.

-pop (*)

Pop items from the local stack at selected positions.
(eq. to '-pp').
Command subset (if any) stands for stack indices instead of
image indices.

-error message (*)

Print specified error message, on the standard output, and quit
interpreter.
Command subset (if any) stands for displayed scope indices
instead of image indices.

-progress 0<=value<=100 | (*)
-1
Set the progress indice of the current processing pipeline.
This command is useful only when G'MIC is used by an embedding
application.

Input/output
------------

-input filename | (*)
[image]x_nb_copies>0 |
{ width>0[%] | [image_w] },{ _height>0[%] |
[image_h] },{ _depth>0[%] | [image_d] },
{ _spectrum>0[%] | [image_s] },_value1,_value2,..
|
(value1{,|;|/|^}value2{,|;|/|^}..)
Insert a new image taken from a filename or from a copy of an
existing image ['indice'],
or insert new image with specified dimensions and values.
(eq. to '-i' | (no args)).
-output filename,_format_options (*)

Output selected images as one or several numbered file(s).
(eq. to '-o').
-verbose level | (*)
{ + | - }
Set or increment/decrement the verbosity level.
(eq. to '-v').
When 'level'>=0, G'MIC log messages are displayed on the stan
dard output.
Default value for the verbosity level is 0.
-print (*)

Output informations on selected images, on the standard output.
-echo message (*)

Output specified message, on the standard output.
(eq. to '-e').
Command subset (if any) stands for displayed scope indices
instead of image indices.

-warning message (*)

Print specified warning message, on the standard output.
Command subset (if any) stands for displayed scope indices
instead of image indices.

-command filename | (*)

Import G'MIC custom command(s) from specified file or string.
(eq. to '-m').
Imported commands are available directly after the '-command'
invokation.

-type datatype (*)

Set pixel datatype for all images of the list.
'datatype' can be { bool | uchar | char | ushort | short | uint
|
int | float | double }.
-shell (*)

Start interactive shell environment, with selected images.
-shared x0[%],x1[%],y[%],z[%],v[%] | (*)
y0[%],y1[%],z[%],v[%] |
z0[%],z1[%],v[%] |
v0[%],v1[%] |
(no args)
Insert shared buffers from (opt. points/lines/planes/channels
of) selected images.
(eq. to '-sh').
-display

Display selected images in an interactive viewer (use the
instant window [0] if opened).
(eq. to '-d').
-display3d

Display selected 3d objects in an interactive viewer (use the
instant window [0] if opened).
(eq. to '-d3d').
-plot _plot_type,_vertex_type,_xmin,_xmax,_ymin,_ymax |
'formula',_resolution>=0,_plot_type,_ver
tex_type,_xmin,xmax,_ymin,_ymax

Display selected image or formula in an interactive viewer (use
the instant window [0] if
opened).
'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 }.
'xmin','xmax','ymin','ymax' set the coordinates of the dis
played xy-axes.

-window _width[%]>=-1,_height[%]>=-1,_normaliza
tion,_fullscreen,_title

Display selected images into an instant window with specified
size, normalization type,
fullscreen mode and title.
(eq. to '-w').
If 'width' or 'height' is set to -1, the corresponding dimen
sion is adjusted to the window
or image size.
'width'=0 or 'height'=0 closes the instant window.
'normalization' can be { -1=keep same | 0=none | 1=always |
2=1st-time | 3=auto }.
'fullscreen' can be { -1=keep same | 0=no | 1=yes }.
You can manage up to 10 different instant windows by using the
numbered variants
'-w0' (default, eq. to '-w'),'-w1',..,'-w9' of the command
'-w'.

-wait delay |
(no args)
Wait for a given delay (in ms) or for an user event occuring on
the selected instant window.
'delay' can be { <0=delay+flush | 0=event | >0=delay }.
Command subset (if any) stands for instant window indices
instead of image indices.

-select feature

Interactively select a feature from selected images (use the
instant window [0] if opened).
'feature' can be { 0=point | 1=segment | 2=rectangle |
3=ellipse }.
The retrieved feature is returned as a vector containing the
feature coordinates.

Shortcuts for native commands
-----------------------------

-h eq. to '-help'. (*)
-+ eq. to '-add'.
-- eq. to '-sub'.
-* eq. to '-mul'.
-** eq. to '-mmul'.
-/ eq. to '-div'.
-^ eq. to '-pow'.
-<< eq. to '-bsl'.
->> eq. to '-bsr'.
-== eq. to '-eq'.
-!= eq. to '-neq'.
-> eq. to '-gt'.
->= eq. to '-ge'.
-< eq. to '-lt'.
-<= eq. to '-le'.
-= eq. to '-set'.
-f eq. to '-fill'.
-t eq. to '-threshold'.
-c eq. to '-cut'.
-n eq. to '-normalize'.
-r eq. to '-resize'.
-s eq. to '-split'.
-a eq. to '-append'.
-rm eq. to '-remove'. (*)
-k eq. to '-keep'. (*)
-mv eq. to '-move'. (*)
-rv eq. to '-reverse'. (*)
-nm eq. to '-name'. (*)
-+3d eq. to '-add3d'.
--3d eq. to '-sub3d'.
-*3d eq. to '-mul3d'.
-/3d eq. to '-div3d'.
-c3d eq. to '-center3d'.
-n3d eq. to '-normalize3d'.
-rot3d eq. to '-rotate3d'.
-col3d eq. to '-color3d'.
-o3d eq. to '-opacity3d'.
-rv3d eq. to '-reverse3d'.
-p3d eq. to '-primitives3d'.
-s3d eq. to '-split3d'.
-l3d eq. to '-light3d'.
-f3d eq. to '-focale3d'.
-sl3d eq. to '-specl3d'.
-ss3d eq. to '-specs3d'.
-db3d eq. to '-double3d'.
-m3d eq. to '-mode3d'.
-md3d eq. to '-moded3d'.
-b3d eq. to '-background3d'.
-x eq. to '-exec'. (*)
-u eq. to '-status'. (*)
-b eq. to '-break'. (*)
-l eq. to '-local'. (*)
-endl eq. to '-endlocal'. (*)
-q eq. to '-quit'. (*)
-p eq. to '-push'. (*)
-p= eq. to '-push='. (*)
-pp eq. to '-pop'. (*)
-e eq. to '-echo'. (*)
-i eq. to '-input'. (*)
-o eq. to '-output'. (*)
-sh eq. to '-shared'. (*)
-v eq. to '-verbose'. (*)
-m eq. to '-command'. (*)
-d eq. to '-display'.
-d3d eq. to '-display3d'.
-w eq. to '-window'.
Default custom commands
-----------------------
** Basic pixel manipulation :

-replace_nan _expression

Replace all NaN values in selected images by specified expres
sion.

-replace_inf _expression

Replace all infinite values in selected images by specified
expression.

-roundify _gamma>=0

Apply roundify transformation on float-valued data, with speci
fied gamma.

-complex2polar

Compute complex to polar transforms of selected images.
-polar2complex

Compute polar to complex transforms of selected images.
-plot2value

Retrieve values from selected 2d graph plots.
-transfer_histogram

Transfer histogram of the last selected image to the other
ones.

-normalize_sum

Normalize selected images with a unitary sum.
-apply_gamma gamma

Apply gamma correction to selected images.
-apply_curve 0<smoothness<1,y0,x1,y1,x2,y2,...,xN-1,yN-1,yN

Apply curve transformation to image values.
-negative

Compute negative of selected images.
-tones N>0

Get N tones masks from selected images.
-t2 eq. to '-threshold2'.
-threshold2 _min,_max

Threshold selected images between the two given values (eq. to
'-t2').

** Geometric manipulation :

-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.
-r2dx eq. to '-resize2dx'.
-resize2dx width>0,_interpolation_type={0,1,2,3,4,5}

Resize selected images along the X-axis, preserving 2d ratio
(eq. to '-r2dx').

-r3dx eq. to '-resize3dx'.
-resize3dx width>0,_interpolation_type={0,1,2,3,4,5}

Resize selected images along the X-axis, preserving 3d ratio
(eq. to '-r3dx').

-r2dy eq. to '-resize2dy'.
-resize2dy height>0,_interpolation_type={0,1,2,3,4,5}

Resize selected images along the Y-axis, preserving 2d ratio
(eq. to '-r2dy').

-r3dy eq. to '-resize3dy'.
-resize3dy height>0,_interpolation_type={0,1,2,3,4,5}

Resize selected images along the Y-axis, preserving 3d ratio
(eq. to '-r3dy').

-r3dz eq. to '-resize3dz'.
-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,_anisot
ropy=[0,1],sharpening>=0

Upscale selected images with an edge-preserving algorithm.
-expand_x size_x>=0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Expand selected images along the X-axis.
-expand_y size_y>=0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Expand selected images along the Y-axis.
-expand_z size_z>=0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Expand selected images along the Z-axis.
-expand_xy size>=0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Expand selected images along the XY-axes.
-expand_xyz size>=0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Expand selected images along the XYZ-axes.
-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.
-shrink_xy size>=0

Shrink selected images along the XY-axes.
-elevate _depth,_is_plain,_is_colored

Elevate selected 2d images into 3d volumes.
** Input-Output :

-ow eq. to '-outputw'.
-outputw

Output selected images by overwritting their original location
(eq. to '-ow').

-op eq. to '-outputp'.
-outputp prefix

Output selected images as prefixed versions of their original
filenames (eq. to '-op').

-on eq. to '-outputn'.
-outputn filename

Output selected images as automatically numbered filenames in
repeat..done loops (eq. to '-on').

-d0 eq. to '-display0'.
-display0

Display selected images with value normalization off (eq. to
'-d0').

-dfft eq. to '-display_fft'.
-display_fft

Display fourier transform of selected images, with centered
log-module and argument (eq. to '-dfft').

-drgba eq. to '-display_rgba'.
-display_rgba

Render selected RGBA images over a checkerboard background (eq.
to '-drgba').

-dh eq. to '-display_histogram'.
-display_histogram _width>0,_height>0,_clus
ters>0,_max_value>0,_show_axes={ 0 | 1 }

Render a channel-by-channel histogram (eq. to '-dh').
-dt eq. to '-display_tensors'.
-display_tensors _size_factor>0,_ellipse_factor>=0,_opacity,_pat
tern,_color1,..

Render field of 2x2 tensors with ellipses.
-float2int8

Convert selected float-valued images to 8bits integer represen
tations.

-int82float

Convert selected 8bits integer representations to float-valued
images.

-float2fft8

Convert selected float-valued images to 8bits fourier represen
tations.

-fft82float

Convert selected 8bits fourier representations to float-valued
images.

** Image creation and drawing :

-ball _R,_G,_B

Draw a colored RGBA ball sprite on selected images.
-sierpinski recursion_level>=0

Draw Sierpinski triangle on selected images.
-text_outline text,_x[%],_y[%],_font_height>0,_outline>=0,_opac
ity,_color1,..

Draw specified colored and outlined text string on selected
images.

-histogram_cumul _nb_levels>0,_is_normalized={ 0 | 1 }

Compute cumulative histogram of selected images.
-direction2rgb

Compute RGB representation of selected 2d direction fields.
-vector2tensor

Convert selected vector fields to corresponding diffusion ten
sor fields.

-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.
-lic _amplitude>0,_channels>0

Generate LIC representation of vector field.
-gaussian _sigma1[%],_sigma2[%],_angle

Draw a centered gaussian on selected images, with specified
standard deviations and orientation.

** Image filtering :

-blur_x amplitude[%]>=0,_borders={ 0 | 1 }

Blur selected images along the X-axis.
-blur_y amplitude[%]>=0,_borders={ 0 | 1 }

Blur selected images along the Y-axis.
-blur_z amplitude[%]>=0,_borders={ 0 | 1 }

Blur selected images along the Z-axis.
-blur_xy amplitude_x[%],amplitude_y[%],_borders={ 0 | 1 }

Blur selected images along the X and Y axes.
-blur_xyz amplitude_x[%],amplitude_y[%],amplitude_z,_bor
ders={ 0 | 1 }

Blur selected images along the X, Y and Z axes.
-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=dirichlet | 1=neumann }

Apply linear blur on selected images, with specified angle and
amplitudes.

-dog _sigma1>=0[%],_sigma2>=0[%]

Compute difference of gaussian on selected images.
-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.
-remove_hotpixels _mask_size>0, _threshold[%]>0

Remove hot pixels in selected images.
-richardson_lucy ampli
tude[%]>=0,_nb_iter>=0,_dt>=0,_regul>=0,_regul_type={ 0=Tikhonov | 1=meancurv. | 2=TV }

Deconvolve image with the iterative Richardson-Lucy algorithm.
-oriented_richardson_lucy amplitude1[%]>=0,_ampli
tude2[%]>=0,_angle,_nb_iter>=0,_dt>=0,_regul>=0,_regul_type={
0=Tikhonov | 1=meancurv. | 2=TV }

Deconvolve image with the iterative Richardson-Lucy algorithm
for oriented kernels.

-unsharp _radius[%]>=0,_amount>=0,_threshold[%]>=0

Apply unsharp mask on selected images.
-unsharp_octave _nb_scales>0,_radius[%]>=0,_amount>=0,thresh
old[%]>=0

Apply octave sharpening on selected images.
-normalize_local _ampli
tude>=0,_radius>0,_n_smooth>=0[%],_a_smooth>=0[%],_cut={ 0 | 1 },_min=0,_max=255

Normalize selected images locally.
-fftpolar

Compute fourier transform of selected images, as centered mag
nitude/phase images.

-ifftpolar

Compute inverse fourier transform of selected images, from cen
tered magnitude/phase images.

-convolve_fft

Convolve selected images two-by-two through fourier transforms.
-deconvolve_fft

Deconvolve selected images two-by-two through fourier trans
forms.

-bandpass _min_freq[%],_max_freq[%]

Apply bandpass filter to selected images.
-watermark _text

Add an textual watermark in the frequency domain 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.
-erode_oct _size>=0

Apply octagonal erosion of selected images by specified size.
-dilate_oct _size>=0

Apply octagonal dilation of selected image by specified size.
-erode_circ _size>=0

Apply circular erosion of selected images by specified size.
-dilate_circ _size>=0

Apply circular dilation of selected image by specified size.
** Contours and variations :

-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.
-inn

Compute gradient-directed 2nd derivative of image(s).
-iee

Compute gradient-orthogonal-directed 2nd derivative of
image(s).

-curvature

Compute isophote curvatures on selected images.
-edges _threshold>=0

Estimate contours of selected images.
-isophotes _nb_levels>0

Render isophotes of selected images on a transparent back
ground.

-topographic_map _nb_levels>0,_smoothness

Render selected images as topographic maps.
-segment_watershed _threshold>=0

Apply watershed segmentation on selected images.
** Arrays and frames :

-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.
-array_pattern _M>0,_N>0,_density>=0,_angle>=0,_zoom>=0,_opac
ity,_expand_type={0,1,2}

Create random MxN array from selected images.
-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,_col1,...,_colN

Insert RGBA-colored frame in selected images.
-frame_fuzzy _size_x>=0,_size_y>=0,_fuzzyness>=0,_smooth
ness>=0,_R,_G,_B,_A

Draw RGBA-colored fuzzy frame in selected images.
-frame_round _sharpness>0,_size>=0,_smooth
ness,_shade,_R,_G,_B,_A

Draw RGBA-colored round frame in selected images.
-frame_blur _sharpness>0,_size>=0,_smoothness,_shade,_blur

Draw RGBA-colored round frame in selected images.
-frame_pattern _M>=3,_pattern = { 0=first image | 1=self },_con
strain_size = { 0 | 1 }

Insert selected pattern frame in selected images.
-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.
-linearize_tiles _M>0,_N>0

Linearize MxN tiles on selected images.
-quadratize_tiles _M>0,_N>0

Quadratize MxN tiles on selected images.
** Artistic effects :

-polaroid _size1>=0,_size2>=0

Create polaroid effect in selected images.
-drop_shadow _offset_x[%],_offset_y[%],_smoothness[%]

Drop shadow behind selected images.
-tetris _scale>0

Apply tetris effect on selected images.
-mosaic _density>=0,_edges={ 0 | 1 }

Create random mosaic from selected images.
-puzzle _scale>=0

Apply puzzle effect on 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.
-ellipsionism _R>0[%],_r>0[%],_smoothness>=0[%],_opacity,_out
line>0,_density>0

Apply ellipsionism filter to selected images.
-whirls _texture>=0,_smoothness>=0,_darkness>=0,_light
ness>=0

Add random whirl texture to selected images.
-cartoon _smoothness,_sharpening,_threshold>=0,_thick
ness>=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.
-stencil _radius[%]>=0,_smoothness>=0,_iterations>=0

Apply stencil filter on 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.
-sketchbw

_nb_orients>0,_start_angle,_angle_range>=0,_length>=0,_thresh
old>=0,
_opacity,_bgfactor>=0,_density>0,_sharpness>=0,
_anisotropy>=0,_smoothness>=0,_coherence>=0,_is_boost={ 0 | 1
},_is_curved={ 0 | 1 }

Apply sketch effect to selected images.
-ditheredbw

Create dithered B&W version of selected images.
-dotsbw _nb_scales>=0,_resolution>0,_radius>=0

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,_opac
ity,_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.
** Spatial warping :

-euclidean2polar _cx,_cx,_n>0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Apply euclidean to polar transform on selected images.
-polar2euclidean _cx,_cy,_n>0,_borders={ 0=dirichlet | 1=neumann |
2=cyclic }

Apply polar to euclidean transform on selected images.
-warp_perspective _x-angle,_y-angle,_zoom>0,_x-center,_y-cen
ter,_borders={ 0=dirichlet | 1=neumann | 2=cyclic }

Warp selected images with perspective deformation.
-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=dirichlet | 1=neu
mann | 2=cyclic }

Apply twirl deformation on selected images.
-map_sphere _width>0,_height>0,_radius,_dilation>0

Map selected images on a sphere.
-flower _amplitude,_frequency,_off
set_r[%],_angle,_cx,_cy,_borders={ 0=dirichlet | 1=neumann | 2=cyclic }

Apply flower deformation on selected images.
-zoom _factor,_cx,_cy,_cz,_borders={ 0=dirichlet |
1=neumann | 2=cyclic }

Apply zoom factor to selected images.
-deform _amplitude>=0

Apply random smooth deformation on selected images.
-fish_eye _x,_y,0<=_radius<=100,_amplitude>=0

Apply fish-eye deformation on selected images.
-transform_polar

Apply user-defined transform on polar representation of
selected images.

-kaleidoscope _cx,_cy,_radius,_angle,_borders={ 0=dirichlet |
1=neumann | 2=cyclic }

Create kaleidoscope effect from selected images.
-rotoidoscope _cx,_cy,_tiles>0,_smoothness[%]>=0,_borders={
0=dirichlet | 1=neumann | 2=cyclic}

Create rotational kaleidoscope effect from selected images.
** Image degradation :

-spread _dx>=0,_dy>=0,_dz>=0

Spread pixel values of selected images randomly along x,y and
z.

-shade_stripes _frequency>=0,_direction={ 0 | 1 },_dark
ness>=0,_lightness>=0

Add shade stripes to selected images.
-stripes_y _frequency>=0

Add vertical stripes to selected images.
-shadow_patch _opacity>=0

Add shadow patches to selected images.
-light_patch _density>0,_darkness>=0,_lightness>=0

Add light patches to selected images.
-light_relief _ambient_light,_specular_light,_specu
lar_size,_darkness,_xl,_yl,_zl,_zscale,_opacity_bumpmap={ 0 | 1 }

Apply relief light to 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.
-paper

Add paper texture to selected images.
-cracks _density>=0,_amplitude,_relief={ 0 | 1 }

Add random cracks to selected images.
** Color-related filters :

-apply_channels

Apply specified command on chosen normalized channels of each
selected images.

-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=adaptive | 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,_smooth
ness[%]>=0,src1,...,srcN,dest1,...,destN

Replace pixels from/to specified colors in selected images.
-fc eq. to '-fill_color'.
-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.
-mix_channels (a00,...,aMN)

Apply specified matrix to channels of selected images.
-solarize

Solarize selected images.
-sepia

Apply sepia tones effect on selected images.
-split_opacity

Split color and opacity parts of selected images.
-red_eye 0<=_threshold<=100,_smoothness>=0,0<=attenua
tion<=1

Attenuate red-eye effect in selected images.
-rgb2lch

Convert selected images from RGB to Lch color bases.
-lch2rgb

Convert selected images from Lch to RGB color bases.
-lab2lch

Convert selected images from Lab to Lch color bases.
-lch2lab

Convert selected images from Lch to Lab color bases.
** Image fading and composition :

-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_channels

Compose all channels of each selected image, using specified
arithmetic operator (+,-,or,min,...).

-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

Compose selected images togethers using edge composition.
-compose_fade

Compose selected images togethers using a given fading (defined
as the latest image).

-compose_shapeaverage

Compose selected images two-by-two, using shape average mode.
** Motion-related and video processing :

-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 }).

-animate

fil
ter_name,(params_start;..;..),(params_end;..;..),nb_frames>=0,_output_frames={ 0 | 1 },_filename |
delay>0
Animate filter from starting parameters to ending parameters.
** 3d-related filters :

-empty3d

Create new empty 3d object.
-apply_pose3d p1,..,p12

Apply 3d pose matrix to selected 3d objects.
-animate3d _width>0,_height>0,_dx,_dy,_dz,_zoom>=0,_filename

Animate selected 3d objects in a window.
-balls3d _size>0,_R,_G,_B,_opacity

Convert selected 3d objects into 3d ball sets.
-imagecube3d

Create 3d mapped cubes from selected images.
-imagepyramid3d

Create 3d mapped pyramides from selected images.
-pyramid3d _width,_height

Create 3d pyramid at (0,0,0), with specified geometry.
-text3d text,_font_height>0,_depth>0,_smoothness

Create a 3d text object from specified text.
-gmic3d

Create a 3d G'MIC logo.
-sierpinski3d _recursion_level>=0,_width,_height

Create new 3d Sierpinski pyramid.
-snapshot3d _size>0,_zoom>=0

Create 2d snapshots of selected 3d objects.
Set 'zoom' to 0 to disable object auto-scaling.
** Interactive demos :

-x_mandelbrot _julia={ 0 | 1 },_c0r,_c0i

Launch Mandelbrot/Julia explorer.
-x_fish_eye

Launch fish-eye demo.
-x_spline

Launch spline curve editor.
-x_tictactoe

Launch tic-tac-toe game.
-x_fourier

Launch fourier filtering demo.
-x_life

Launch the game of life.
-x_fire

Launch the fire demo.
-x_light

Launch the light demo.
-x_jawbreaker 0<_width<20,0<_height<20,0<_balls<=8

Launch the Jawbreaker game.
-x_paint

Launch the interactive painter.
Examples of use
---------------
'gmic' is a generic image processing tool which can be used in a wide
variety of situations.
Here are few examples of possible uses :

- View a list of images :
gmic file1.bmp file2.jpeg
- Convert an image file :
gmic input.bmp -o output.jpg
- Create a 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 fading :
gmic image1.jpg image2.jpg -compose_overlay -o composed.jpg
- Evaluate a mathematical expression :
gmic -e
- Plot a 2d function :
gmic 1000,1,1,2 -f
- Plot a 3d elevated function in random colors:
gmic 128,128,1,3,
128,128,1,1,
-elevation3d[-2] [-1] -rm[-1]
- Plot the isosurface of a 3d volume :
gmic -m3d 5 -md3d 5 -db3d 0 -isosurface3d
- Create a G'MIC 3d logo :
gmic 180,70,1,3 -text G\'MIC,30,5,57,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]
-*3d[-1] 0.5,1 -if
-rot3d 0,0,1,18 -done -md3d 3 -m3d 5 -db3d 0
- Create a vase from a 3d isosurface :
gmic -md3d 4 -isosurface3d
--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

- Launch a set of G'MIC interactive demos :
gmic -x_fish_eye -x_fire G\'MIC -x_tictactoe -rm -x_spline -x_man
delbrot 0 -x_life

** G'MIC comes with ABSOLUTELY NO WARRANTY; for details visit
http://gmic.sourceforge.net **
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout