Release of G'MIC 3.0

Fear not, I have plans to try out communication with databases. That’s likely to spring more questions! Failing that, there are years of my own g’mic notes and scripts to review :slight_smile:

Edit: oops, forgot to say that the new files2img command has simplified some things immensely for me. It works incredibly well when coupled with rows and {t}, and after switching to named images I’m no longer spending hours swearing at macros and strings!

1 Like

@David_Tschumperle Is it possible to use clipboard in G’MIC? I’d like to see that feature if it isn’t.

No it is not possible for the moment. Not sure this is something G’MIC has to manage. What would be the use case ?

It is obscure, but suppose I want a quick way of picking color from random online images with interactive tool and then echo out the color representation. If I didn’t have to save a image or pasted in a image editor, I could save myself some few clicks. And if I were able to call clipboard2img command from said interactive tool, I wouldn’t need to restart the interactive command.

Obscure, yes. I could understand why it wouldn’t be worth it.

For this, I often use $ gmic screen.

@garagecoder , just to notify you that files2img will return its result in a slightly different form : instead of having the list of files stored row by row, it will return a 1xNx1xS image, where N is the number of files found, and S the maximum length of the corresponding filenames.
So that it will be more simple to access:

foo : 
  files2img *.txt
  repeat h e {`I[$>]`} done
1 Like

Yes. In my case, I would like to see HSV8 call-out of the color and I’d imagine other might want LCH, etc.

@Reptorian

Bonjour,

message : On the road to 3.0 - #412 by Reptorian

I can not use the screens settings in the command lines, for example :

gmic cursor 0 Screen_W={*,u} Screen_H={*,v} repeat 5 fx_image_sample 0,0,0 resize $Screen_W,$Screen_H window 100%,100%,0,1 cursor 0 wait 1000 remove done

This line works in the Windows terminal or console but not the cursor.

This line does not work in the MSYS2 and PowerShell terminals and I have to use variables like Garagecoder (message On the road to 3.0 - #411 by garagecoder ).
Nota : You have to adapt this line by adding ./ for msys2 and ./ or .\ For PowerShell at the beginning.

I want to make a small slide show program. Do you have a solution for {*,u} and {*,v} ?

Thank you :o)

I’m not quite sure what you mean - I tested this in a virtual machine windows 10 and it looks OK for me, the cursor disappears. The only problem I had with fullscreen on windows is that the taskbar gets in the way. Sometimes using gmic run "commands here" does the job.

I just added gcd_browse for that. It will be a while before it’s available with gmic up. Perhaps you can get some clues there, it works for me on windows VM. It uses keyboard only, but you can always copy and edit.

@garagecoder
Bonjour,

Thank you for the answer.
The command line does not always work well. For example when the cursor touches a side of the screen. I do not know why.

I will look at your ‘GCD_BROWSE’ script and adapt it as an example in a .bat file that will use PowerShell as a launcher of the Slide Show.

:o)

On windows, I usually put longer commands into the file user.gmic in %AppData%. Otherwise, it becomes more difficult to escape disallowed terminal characters. But good luck anyway!

@garagecoder

There is no problem because I ‘recreate’ the filter from the .bat file.
This is the way I use to avoid the problems of characters, I cross the fingers…
:o)

Edit 20211118
In the archive there is ‘Test_Full-Screen_GMIC-CLI.bat’ to put in the gmic.exe directory.
Click on to launch the Slide Show PowerShell.
This is an example like the post On the road to 3.0 - #463 by samj and the images are simply put to the size of the screen.
The cursor disappears during the Slide Show.

Test_Full-Screen_GMIC-CLI.7z (725 Bytes)

1 Like

I tried this batch file and it does exactly the same as your earlier example. What I did have to do in powershell is use this:

.\gmic.exe run "cursor 0 Screen_W={*,u} Screen_H={*,v} repeat 5 fx_image_sample 0,0,0 resize `$Screen_W,`$Screen_H window 100%,100%,0,1 cursor 0 wait 1000 remove done"

So that is two things: use gmic run "...stuff here..." and put a backtick ` before each $ to escape them.

1 Like

@garagecoder
Bonjour,
Your command line works very well and there is no cursor problem :o)
My previous message script also allows you to display on a system with multiple monitors.
I also like the ability to easily create file lists with a .bat file in a foo.gmic program that I call next.
I will use your advice.
:o)

Ah! Substitution Rule Number 2. Neither the techical reference name nor tutorial name seem conversant with the notion that a $-prefixed selection name resolves to the highest-value image index that is encompassed by the named selection. Being by nature terse, I suppose one might excuse the technical reference, but the tutorial needs upgrading. Throw another one on the TODO list (clunk!).

gmic 1,1,1,3,[127,127,127] name Gray echo "Select Gray: "\$Gray
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input image at position 0, with values '[127,127,127]' (1 image 1x1x1x3).
[gmic]-1./ Set name of image [0] to 'Gray'.
[gmic]-1./ Select gray: 0
[gmic]-1./ Display image [0] = 'Gray'.
[0] = 'Gray':
  size = (1,1,1,3) [12 b of floats].
  data = (127 ^ 127 ^ 127).
  min = 127, max = 127, mean = 127, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-1./ End G'MIC interpreter.

The image indices encompassed by named selections track the repositioning of constituent images, and the substitution form reflects such resequencing:

$ gmic 1,1,1,3,[127,127,127] name Gray [Gray]x4 name[1--1:2] LightPink name[2--1:2] DarkGreen fill_color[LightPink] 255,188,250 fill_color[DarkGreen] 79,107,53  echo "Select Gray: "\$Gray  echo "Select LightPink: "\$LightPink  echo "Select DarkGreen: "\$DarkGreen -d0 -luminance sort_list +,i echo "$Select Gray: "\$Gray  echo "Select LightPink: "\$LightPink  echo "Select DarkGreen: "\$DarkGreen -d0

$  gmic 1,1,1,3,[127,127,127] name Gray [Gray]x4 name[1--1:2] LightPink name[2--1:2] DarkGreen fill_color[LightPink] 255,188,250 fill_color[DarkGreen] 79,107,53  echo "Select Gray: "\$Gray  echo "Select LightPink: "\$LightPink  echo "Select DarkGreen: "\$DarkGreen -d0 -luminance sort_list +,i echo "$Select Gray: "\$Gray  echo "Select LightPink: "\$LightPink  echo "Select DarkGreen: "\$DarkGreen -d0
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input image at position 0, with values '[127,127,127]' (1 image 1x1x1x3).
[gmic]-1./ Set name of image [0] to 'Gray'.
[gmic]-1./ Input 4 copies of image [0] at position 1 (4 images [0] = 1x1x1x3, (...),[3] = 1x1x1x3).
[gmic]-5./ Set names of images [1,3] to 'LightPink'.
[gmic]-5./ Set names of images [2,4] to 'DarkGreen'.
[gmic]-2./ Fill images [1,3] with color (255,188,250).
[gmic]-2./ Fill images [2,4] with color (79,107,53).
[gmic]-5./ Select Gray: 0
[gmic]-5./ Select LightPink: 3
[gmic]-5./ Select DarkGreen: 4
[gmic]-5./ Start interactive display of 2d images [0,1,2,3,4].
[gmic]-5./d0/_display2d/ Print images [0,1,2,3,4] = 'Gray, (...), DarkGreen'.
[0] = 'Gray':
  size = (1,1,1,3) [12 b of floats].
  data = (127 ^ 127 ^ 127).
  min = 127, max = 127, mean = 127, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[1] = 'LightPink':
  size = (1,1,1,3) [12 b of floats].
  data = (255 ^ 188 ^ 250).
  min = 188, max = 255, mean = 231, std = 37.3229, coords_min = (0,0,0,1), coords_max = (0,0,0,0).
[2] = 'DarkGreen':
  size = (1,1,1,3) [12 b of floats].
  data = (79 ^ 107 ^ 53).
  min = 53, max = 107, mean = 79.6667, std = 27.0062, coords_min = (0,0,0,2), coords_max = (0,0,0,1).
[3] = 'LightPink':
  size = (1,1,1,3) [12 b of floats].
  data = (255 ^ 188 ^ 250).
  min = 188, max = 255, mean = 231, std = 37.3229, coords_min = (0,0,0,1), coords_max = (0,0,0,0).
[4] = 'DarkGreen':
  size = (1,1,1,3) [12 b of floats].
  data = (79 ^ 107 ^ 53).
  min = 53, max = 107, mean = 79.6667, std = 27.0062, coords_min = (0,0,0,2), coords_max = (0,0,0,1).
[gmic]-5./ Compute luminance of images [0,1,2,3,4].
[gmic]-5./ Sort list of images [0,1,2,3,4] in ascending order, according to the image criterion 'i'.
[gmic]-5./  Gray: 2
[gmic]-5./ Select LightPink: 4
[gmic]-5./ Select DarkGreen: 1
[gmic]-5./ Start interactive display of 2d images [0,1,2,3,4].
[gmic]-5./d0/_display2d/ Print images [0,1,2,3,4] = 'DarkGreen, (...), LightPink'.
[0] = 'DarkGreen':
  size = (1,1,1,1) [4 b of floats].
  data = (99.0701).
  min = 99.0701, max = 99.0701, mean = 99.0701, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[1] = 'DarkGreen':
  size = (1,1,1,1) [4 b of floats].
  data = (99.0701).
  min = 99.0701, max = 99.0701, mean = 99.0701, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[2] = 'Gray':
  size = (1,1,1,1) [4 b of floats].
  data = (127).
  min = 127, max = 127, mean = 127, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[3] = 'LightPink':
  size = (1,1,1,1) [4 b of floats].
  data = (209.488).
  min = 209.488, max = 209.488, mean = 209.488, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[4] = 'LightPink':
  size = (1,1,1,1) [4 b of floats].
  data = (209.488).
  min = 209.488, max = 209.488, mean = 209.488, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-5./ End G'MIC interpreter.

Is it possible to programmatically resolve the (possible) vector which a named selection could represent? For example, above, the named selection “LightPink” initially represented a vector of image indices [1,3], and after sorting, that name selection became vector [3,4], reflecting the repositioning of members of the selection. I could imagine circumstances where I could make use of obtaining such dynamically changing vectors, as in: “Where are the members of “LightGreen” now on the image list?”

Probably -named? See doc page : G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing - Reference Documentation - named

@garagecoder
Bonjour,

Tests of the command line On the road to 3.0 - #468 by garagecoder

I tested your command line with Windows and MSYS2 consoles.
Everything works perfectly.
The problem of the cursor seems to me resolved :o)

In the case of the Windows console :

  • ’run’ makes it possible to obtain a correct result. Well done!
  • Do not use the form ‘.\gmic.exe …’ because the problem of the cursor reappears.
  • Do not use a backtick `

In the case of the MSYS2 console :

  • Do not use a backtick ` and/or $

The command lines used that operate during the tests :

Windows console
gmic.exe run "cursor 0 Screen_W={*,u} Screen_H={*,v} repeat 5 fx_image_sample 0,0,0 resize $Screen_W,$Screen_H window 100%,100%,0,1 cursor 0 wait 1000 remove done"

MSYS2 console
./gmic.exe run "cursor 0 repeat 5 fx_image_sample 0,0,0 resize {*,u},{*,v} window 100%,100%,0,1 cursor 0 wait 1000 remove done"

I will test your program ‘gcd_browse’ and if I have remarks I will open a thread on this subject.

You can set gmic as environment path to avoid needing to type in gmic.exe. @samj

This also makes scripting in gmic so much easier as you can make a folder with test pictures. And just redirect cmd to there.

Is it intentionally that custom functions delaunay and delaunay3d are without convex hull resp without the triangles containing convex hull edges. ?

Amazing improvements! Thank you for your incredibly work.