Release of G'MIC 1.7.2

Hello there,

I’m happy to announce the release of a new version 1.7.2 of the G’MIC image processing framework.
It is recommended to update your installation to this newest version as soon as possible, since some important changes and optimizations have been introduced in the G’MIC core that break the compatibility of the filter definitions with the previous versions (so, new filter updates will be available only for version >1.7.2 from now!).

G’MIC is a full-featured open-source framework for image processing. It provides several different user interfaces to convert/manipulate/filter/visualize generic image datasets, ranging from 1d scalar signals to 3d+t sequences of multi-spectral volumetric images, thus including 2d color images.

The following is the full Changelog of the version 1.7.2, as compared to the previous stable version 1.7.1.

New features:

  • [core] New substituting expressions {ind,@subset} (replaces {ind,[subset]}) and {/string} (returns escaped version of string).

  • [core] Improvement of the math parser: New functions find() (to find a sub-sequence in a vector), resize() (to resize a vector-valued variable, using different interpolation methods), -reverse() (to reverse the order of vector components), same(A,B,n) (to compare values of arguments A and B, opt. for the first n values only), fact() (factorial), fibo() (fibonacci sequence), permut() (number of permutations), lowercase() and uppercase(). Math parser now allows string literals (e.g. foo='Hello') and string manipulation.

  • [stdlib] New command -arrow which draws an arrow on selected images.

  • [stdlib] New command -input_clut inserts one of the pre-defined G’MIC Hald-CLUTs at the end of the image list.

Improvements:

  • [core] Slightly improved code for zooming out with mouse wheel in display window (command -display).

  • [core] On Windows, G’MIC now supports the reading of files with UTF-8 filenames.

  • [core] Image viewer now changes the window title according to the viewed images of a list or a sub-list.

  • [core] Improvement in the management of exceptions in OpenMP code blocks, allowing cleaner aborting of running algorithms (may fix possible crashes).

  • [core] Command -_status has been removed. Use new substituting expression {/string} instead.

  • [core] Specific substitution patterns for string comparison have been removed. Use the vector comparison operators == and != of the math parser instead).

  • [data] A bunch of new HaldCLUTs (approx. 30) have been added, with as many new color transformation presets.

Bug fixes:

  • [core] Fixed BMP loading function to avoid segfault with malformed image files.
2 Likes

In the line “Math parser now allows string literals (e.g. foo=‘Hello’) and string manipulation.”, are you referring to string functionality similar to as described in the Convenience Functions section of the Reference Guide (-strlen, -strreplace etc.) or something else? If so, will there be any functions like strncpy in C to extract/copy a portion of one string into another?

Souphead.

Yes, as a string can be manipulated as a vector of values, there will be ways to do things equivalent to strcpy, strcasecmp, strncasecmp, strcat, etc…

To be a bit more precise : In the math parser, a string is exactly the same as a vector. It is actually only a vector whose constructor accepts character codes rather than just plain values.
So for instance, if you define command -test like this :

test :
  -e {`"
str = ['$1'];
l = size(str);  # String length
print(l);
sub_str = str[0,3];  # First 4 characters
"`}

Then you’ll get :

$ gmic -test "Hello, it's me"
[gmic]-0./ Start G'MIC interpreter.
[_cimg_math_parser] l = 14
[gmic]-0./test/ Hell
[gmic]-0./ End G'MIC interpreter.

and

$ gmic -test "Pixls.us is a great site"
[gmic]-0./ Start G'MIC interpreter.
[_cimg_math_parser] l = 24
[gmic]-0./test/ Pixl
[gmic]-0./ End G'MIC interpreter.

I have the following test snippet in the GIMP plugin and I am trying to understand what I am doing wrong:-

#@gimp aFun : afun, afun_preview(1)
#@gimp : Value = text{“test”}

afun_preview :
-afun ${1–1}

afun :
-repeat ! -l[>]
-f. "
init(

str=[’$1’];
length=size(str);

if(str[0,2]==‘vtd’,print(length),print(0));

);

0"
-endl -done

If I run it and pass in three characters “vtu”, it prints ‘length = 3’ as it found a pattern match and it is 3 characters long. Now if I put in “vtu 5”, it again matches on vtu but again prints a length of 3 not 5. If I put in “vtux”, it matches and prints a length of 4 but if I put in “vtu x”, it throws an error saying “Unknown filename x”. If I put in a value of “vtx”, it prints a 0 as there is no character match.

I’m sure this is more likely the plugin rather than the base G’MIC code but any idea what I am doing wrong?

This is with the plugin version 1.7.2#051816 .

Souphead

should be replaced probably by

instead. When invoking a command, the G’MIC parser re-creates each time the command code by substituting the command argument, and if you don’t quote arguments that contain spaces, it’s like you are then invoking -afun with some arguments then you insert the rest of the arguments as a new command (the rest after the space).

Yep, that was it. Thanks.

Souphead.

  • 05/30/2016: Final release!
1 Like

Thanks again for continually making G’MIC better and better, David. :slight_smile:

I honestly don’t know when he finds time to sleep… :wink:

Indeed, but I’m not complaining (even though using G’MIC to create the 100s if not 1000s of renders over the years has caused me sleepless nights; lol). :slight_smile:

1 Like

Thanks for your support Lyle and Pat, you have always been there to help the project in a way or another. I really appreciate it :slight_smile:

1 Like