Release of G'MIC 3.1

ok, there was an error, I wrote elif instead of else and closed with fi ! The l[] was interpreted by the math processor!

cli_start : _vt100=1 if $_version<303
    if $_version<297 m "delete : file_rm $""*" fi
#    if $_version>=299 l[] m 1,/Users/karo/sw/gmic_bm/BAM_299.gmic onfail endl fi 
    l [] if $_version>=301 l[] m 1,/Users/karo/sw/gmic_bm/bh.gmic onfail endl fi 
#    l[] m 1,/Users/karo/sw/gmic/src/gmic_stdlib.gmic onfail endl
#    l[] m 1,/Users/karo/sw/gmic-community/include/karsten_rodenacker.gmic onfail endl
#    l[] m 1,/Users/karo/sw/gmic_bm/ak_surface.gmic onfail endl
#    l[] m 1,/Users/karo/_gmic/blather.gmic onfail endl
#    l[] m 1,/Users/karo/sw/gmic_bm/in.gmic onfail endl
  elif
#    l[] m 1,/Users/karo/sw/gmic_bm/BAM_310.gmic onfail done
    l[] m 1,/Users/karo/sw/gmic_bm/bh.gmic onfail done
#    l[] m 1,/Users/karo/sw/gmic/src/gmic_stdlib.gmic onfail done
#    l[] m 1,/Users/karo/sw/gmic-community/include/karsten_rodenacker.gmic onfail done
#    l[] m 1,/Users/karo/sw/gmic_bm/ak_surface.gmic onfail done
#    l[] m 1,/Users/karo/_gmic/blather.gmic onfail done
#    l[] m 1,/Users/karo/sw/gmic_bm/in.gmic onfail done
  fi

Quite logical, as elif requires an argument that is indeed evaluated by the math evaluator.

So, variadic macros in math parser now work. And the foreach construct is so useful that it is used everywhere now in the stdlib (with or without braces).

By chance, do you have any other ideas like this for improving the language ? :slight_smile:

Remove the need for "s when it comes to $image_name on the math parser.

It should already work BTW. Something as:

foo :
  sp lena nm. img
  eval "xc = w#$img/2;
        yc = h#$img/2;
        ellipse(#$img,xc,yc,15,15,0,0.5,0,255,0)"

is working as expected.

It didn’t work the last time I have tried, but now it does. Thanks. You get no more ideas from me in context of the language itself.

@hover

There is nothing to do, the plug-in Lua does not work on Windows :o(

I’ve fixed a small (but annoying) bug today, related to the new command foreach, that was introducing some crashes in the plug-in, for some filters.
It should be better now. I’ve updated all the pre-release binaires on the G’MIC website.
I guess only a few minor issues should remain. That’s good news!

I’ve converted the stdlib to the use of foreach and { ... } blocks.

I’ll probably stop the development right now, as I’ve important things to do for my research. Do not hesitate to test and report any issue.
Thanks.

3 Likes

Nice. When you release 3.1, there will be some spring cleaning to do. :bucket::broom:

1 Like

New stuff added today :

  • [math-core-310] Interpreter reserved variables $!, $>, $<, $| and $^ are now available in the math evaluator.

So this now works :

foo :
  sp lena,earth,dog,duck,colorful
  foreach
    eval "const count = $>; echo('count = ',count)"
  done
4 Likes

Erm, I don’t see information about these. I would like to have examples of these.

Opening and closing are classical morphological operations :

They are basically :

  • Closing = Dilation then Erosion
  • Openion = Erosion then Dilation

Anyway, it is necessary to pay attention to the boundary conditions when implementing those (so it’s not as simple as closing : dilate $1 erode $1 ). This is why I’ve added these operators as new commands.

1 Like

After looking at the stdlib commit, will I have to use := and vector in the future when it comes to assigning multiple variables?

Not necessarily. It’s a convenience operator, you are not forced to use it.

Questions to those who could test G’MIC 3.1… Did you have any problems with the latest development versions? If not, I might consider doing a release soon.

Hi,
I have not tested development versions but since 2.9.9 I cannot load jpg in the standalone windows application: gmic_x.x.x.x_qt_win64.zip
I ever load a jpg generated with Rawtherapee.
Version 2.9.9:


.
Unable to load jpg: version 3.0.2:

Using the Gimp plugin and Windows CLI 3.1.0 (pre-#220305):

When running command 'fx_houghsketchbw 1.25,10,5,80,0.1,4,0,50,50', this error occurred:
[gmic_gimp_qt]./error/ *** Error in ./fx_houghsketchbw/*if/ *** Command 'done': Not associated     to a 'for', 'foreach' or 'repeat' command within the same scope.

Also for the non-offcial filters .Map Projection’ ( G'mic projection scripts - 2021-01-13 - Pastebin.com )
with default parameters we get e.g:
*** Error in ./lambert_conformal_conic_projection/*if/ *** A ‘fi’ command is missing, before return point.
Any other values show:
*** Error in ./conic_equidistant_projection/*if/ *** Unknown command or filename ‘endif’; did you mean ‘elif’?

rotate_equirectangular_map works well though.

Yes that’s a bit old. Could you please try with the latest binaries I’ve posted yesterday, at : Index of /files/prerelease
?

Those Map Projection are on the list of my TODO to address. Not the highest priority, but eventually I can address them. They will eventually be part of gmic-community, and I have exchanged communication with the author of said filters, he is fine with making them public. I will be doing optimization and fixes.

Version 3.1.0 (pre-release #220316) still the same, though the Hough Sketch is only problematic on the default Color Model option (Color on White)
Thanks!