About the image stack

1.Initial stack

When several images are loaded in G’mic, they are ordered in a stack. It is then possible to refer to them by using either positive (starting from the first image as [0]) or negative numbers (starting from the last image as [-1]).

For example, if 3 images A, B and C are loaded:

gmic A.png B.png C.png

It creates a stack that you can picture like that:

You can refer to A as image [0] or image [-3], B as [1] or [-2] and C as [2] or [-1]. So both commands below do exactly the same thing, they display B:

gmic A.png B.png C.png -display[1]
gmic A.png B.png C.png -display[-2]

2.Command with one dash

If, in your command line, you add an instruction using a single dash, it replaces the images to which the instruction applies by the result. Thus, to split the different channels of B, the 2 commands below could be used is added to our first command:

gmic A.png B.png C.png -split[1] c
gmic A.png B.png C.png -split[-2] c

And they would modified the stack as shown below:

As you can see, the image A is still [0], but not [-3] anymore, it has become [-5].

3.Command with two dashes

To keep the original image, instruction are called using 2 dashes. The original image is indeed kept in place and the result is added at the end of the stack.
So commands below:

gmic A.png B.png C.png --split[1] c
gmic A.png B.png C.png --split[-2] c

would modify the stack as below:

4.Stack order matters, not invoking order

When you apply a command to several images, sometimes, order matters. But be careful, stack order matters, not invoking order.
For example, both commands below have the same result:

gmic A.png B.png -append[0,1] y
gmic A.png B.png -append[1,0] y

If you want to apply your command in another order, you have to play with the image stack, such as:

gmic A.png B.png -reverse[0,1] -append[0,1] y

or

gmic A.png B.png -move[1] 0 -append[1,0] y
    • PhotoComix
    • March 5th, 2011

    How i could have missed this till now ?
    thank , finally i diciver because layers(images) were never were i expected…i was counting with negative number from the top
    (So i tought that 0 was -1 and so on..)

    the first image cleared immediatly and the text did the rest,

    thank again

  1. January 21st, 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: