This morning, I’ve done this:
A bit of explanation :
In G’MIC, you have the possibility to insert a new image in the image list by specifying directly its pixel values, like:
$ gmic (1,2,3;4,5,6;7,8,9)
Here, it creates a 3x3 scalar image with values from 1
to 9
.
That’s actually quite useful in a number of situations.
But there was a limitation: In such expressions, the order of axis delimiters where considered to be first the x-axis, then the y-axis, then the z-axis and finally the c-axis (channels).
It means that if I wanted to create a 3x1 image of RGB colors (e.g. Red, Green and Blue), I could not just write:
$ gmic (255^0^0,0^255^0,0^0^255)
Writing this would generate a 2x1 image with 7 channels.
The change I’ve made this morning modify this behavior, by first analyzing in the given expression what is the “natural” order of specified values for the axes (not always ‘xyzc’ then).
Then, the parsed values are placed in the image, following the “correct” order.
And now, you get the expected result:
$ gmic (255^0^0,0^255^0,0^0^255)
With this change, this also means you can create a matrix by specifying its coefficient column by column :
$ gmic (1;2;3,4;5;6,7;8;9)
Well that’s it. Nothing spectacular, but still a small improvement to the language !
Cheers.