I’m reading through the G’MIC source code to understand it better. I keep coming across lines like +[-2,-1] and I’m not exactly sure how to process this. At first I thought it meant “add”, but add only takes one param.
Let’s take Retro Fade for example:
fx_retrofade :
repeat $! l[$>] split_opacity l[0]
+f 0
repeat $1
+noise[0] $3 c. 0,255 autoindex. $2,0,0
+[-2,-1]
progress {$>*100/$1}
done
k. n 0,255
progress 100
done a c done done
From what I can tell, the meat of this means:
(1) fill the image with black
(2) for each iteration, apply noise to the original, clamp the noisy image and autoindex it
(3) ??? this is where I’m confused
Then repeat and keep the last image.
Can someone help me figure out this missing piece?
+ in front of command means make new copy of image(s) and do command
hint: + means add and ++ means make new copy and then add
arithmetic operators can be in two forms: add[-2,-1] or add[-2] [-1]
– the first one adds the two images and the result ends up in location [-2] (which is the same as [-1])
– the second one adds [-1] to [-2] and the result is found in [-2]but[-1] still exists
[...] and ... is the selection syntax
in the case of [-2,-1], it involves the second last and last images in the image sequence
and a single . means [-1]
Together, the command does the following:
Repeat through all input images separately
Only work on RGB, separating RGBA and combining it at the end
Create a new 0 image
Create another copy of [0] and then denoise, clip and index it
Add this to the 0'ed image (i.e., [1], which updates each time there is a repetition)
Iterate the above and then keep the result after the loop ends
Normalize image to range
progress shows the progress in the terminal/console