G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing
GREYC CNRS ENSICAEN UNICAEN

A Full-Featured Open-Source Framework for Image Processing



Latest stable version: 3.2.0

Tutorial

Conjuring Images out of the Aether and Other Generators
Typically, images arrive at the pipeline by way of the input command or as an output of some transformative command. To this, one may also conjure images out of the aether, using specialized variations of the input command.

Conjuring images from the aether is fairly straightforward. One writes a series of as many as four integer parameters, spatial dimensions, separated by commas, with no embedded white space. The four numbers represent the width, height, depth and spectral dimensions of an image, like so:

$ gmic 1036,850,1,3 print

[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input black image at position 0 (1 image 1036x850x1x3).
[gmic]-1./ Print image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (1036,850,1,3) [10 Mio of float32].
data = (0,0,0,0,0,0,0,0,0,0,0,0,(...),0,0,0,0,0,0,0,0,0,0,0,0).
min = 0, max = 0, mean = 0, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-1./ End G'MIC interpreter.

which will produce an image 1036 pixels wide, 850 pixels high, one pixel deep, with a spectral dimension of three channels; it will be black unless one writes an optional fifth parameter, a mathematical script that defines image content procedurally. The tutorial on image ramps and the input command itself have examples of procedural image definitions. The four dimensions will conjure an image out of the aether, ready to be transformed by some follow-on command, typically a generator like plasma or noise.

Not all dimensions need to be furnished; omitted dimensions default to one. So
$ gmic 100 print

[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input black image at position 0 (1 image 100x1x1x1).
[gmic]-1./ Print image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (100,1,1,1) [400 b of float32].
data = (0,0,0,0,0,0,0,0,0,0,0,0,(...),0,0,0,0,0,0,0,0,0,0,0,0).
min = 0, max = 0, mean = 0, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-1./ End G'MIC interpreter.
produces a 100x1x1x1 image. The special form
$ gmic 0 print

[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input empty image at position 0 (1 image 0x0x0x0).
[gmic]-1./ Print image [0] = '[empty]'.
[0] = '[empty]':
size = (0,0,0,0) [0 b of float32].
data = () [float32].
[gmic]-1./ End G'MIC interpreter.
produces an empty image where all dimensions are zero. If output, the resulting file will have zero bytes. This special case primarily serves scripts that may be generating images dynamically; the zero dimensioned image serves as a boundary case that can trigger a loop exit.

Images may also be conjured up from other images by way of selections, image indices appearing within square braces. This is an implied copy command; it places the copied images at the end of the pipeline.
G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing

G'MIC is an open-source software distributed under the CeCILL free software licenses (LGPL-like and/or
GPL-compatible). Copyrights (C) Since July 2008, David Tschumperlé - GREYC UMR CNRS 6072, Image Team.