Release of G'MIC 3.1

This is the changelog for the release of the 3.1.0 version of the G’MIC software, released on 2022/04/26.

It lists all new features and changes done since the previous major version 3.0.

What is G’MIC?

G’MIC (GREYC’s Magic for Image Computing) 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.

supportus



^ The plug-in G’MIC-Qt in action, running for GIMP 2.10 ^


What’s new in version 3.1?


From 3.0.2 to 3.1.0

New features:

  • [gmic-qt-310] New filter Rendering / Generate Random Portrait uses the ThisPersonDoesNotExist service to generate images of random portraits.

  • [gmic-qt-310] New filter Artistic / Line Art transforms images into line arts (filter written by Claude Lion).

  • [gmic-qt-310] New preview mode (zoomfactor)* allow a filter to retrieve the whole image, in order to compute a perfectly accurate preview (useful when filter is fast enough). To be used in conjunction with predefined variables $_preview_width, $_preview_height, $_preview_area_width , $_preview_area_height, $_preview_x0, $_preview_y0, $_preview_x1 and $_preview_y1.
  • [core-310] New command foreach, loops over an image selection, image by image and execute each loop iteration in a local image environment. It introduces a useful construct foreach ... done block, to replace e.g. repeat $! l[$>] ... endl done.
  • [math-core-310] Definition of variadic macros are now allowed in the math expression evaluator, e.g: func(arg...) = ( sum([ arg ]^2) );.
  • [stdlib-310] New commands opening, opening_circ, closing and closing_circ which implement morphological opening and closing.
  • [stdlib-310] New commands premula and ipremula convert straight RGBA representation to premultiplied alpha RGBA.

Improvements / modifications:

  • [stdlib-310] Command structuretensors has been recoded as a custom command in the stdlib.
  • [core-310] Command name: if selection is empty or not explicitly specified, it now represents the last ‘N’ images of the list, where ‘N’ is the number of specified arguments to the command name, rather than the entire image list.
  • [core-310] Command name gets a new command shortcut =>. Old shortcut nm still works, for compatibility reasons.
  • [core-310] Substituting expressions '$> and $< (forward and backward loop counters) now works for all kind of loops (for...done, do...while, etc.).
  • [core-310] Command repeat does not accept an additional variable name argument anymore. Use repeat nb_iters i=$> ... done instead.
  • [core-310] Command endl is now replaced by ‘done’.
  • [core-310] Commands endif and endlocal are not supported anymore. Use fi and done instead.
  • [core-310] Command store now accepts large image (>2GB values).
  • [core-310] Code for variable assignment has been recoded from scratch.
  • [core-310] Add checks to detect potentially malicious .bmp or .pan files.
  • [core-310] Names of pixel types have been normalized. Now, they can be { bool | uint8 | int8 | uint16 | int16 | uint32 | int32 | uint64 | int64 | float32 | float64 }.
  • [math-core-310] Interpreter reserved variables $!, $>, $<, $| and $^ are now available in the math evaluator.
  • [packages-310] Added binary packages for Debian 11 “Bullseye” distribution.
  • [packages-310] Added binary packages for Ubuntu 22.04 “Jammy Jellyfish” distribution.

Bug fixes:

  • [stdlib-310] Fix bug in command input_cached for Window users.
  • [core-310] Fix command blur applied on shared images, when boundary_conditions=2.

From 3.0.1 to 3.0.2

(released on 2022/01/18)

Modifications / improvements:

  • [stdlib-302] Commands average_colors and covariance_colors renamed to, respectively average_vectors and covariance_vectors. Command covariance_vectors has been also greatly optimized (multi-threaded calculation).

Bug fixes:

  • [core-302] Fix bug in variable assignment with the := operator.

From 3.0.0 to 3.0.1

(released on 2022/01/13)

New features:

  • [core-301] New variable assignment operator :=, which evaluates the right-hand side as a mathematical expression. So, var:=expr is actually equivalent to var={expr}.

  • [stdlib-301] New command portrait inserts a new portrait image on the image list, retrieved from the web site ThisPersonDoesNotExist.

Modifications / improvements:

  • [core-301] Make variable assignment operators as +=, -=, … evaluate their right-hand side as a math expression, without requiring it to be put between {} .

  • [math-core-301] Slightly improve math parser by merging listin and listout fields.

  • [math-core-301] Functions print() and prints() now print the specified arguments also during compilation time. Useful to check the type of a variable/expression during the compilation of the math expression into bytecodes.

  • [stdlib-301] nn_lib gets new features : softmax layer, binary cross-entropy loss.

  • [stdlib-301] Command boxfitting gets a complete rewrite, implementing a new algorithm that is a lot faster.

  • [build-301] Build G’MIC interfaces are now all using the libgmic.so shared library.

Bug fixes:

  • [math-core-301] Fix floating point exception when functions da_*() are used with no images on the list.
  • [math-core-301] Fix da_remove() and da_pop() when used with multi-channels dynamic arrays.
4 Likes

I notice gmic_qt now appears to resize to RGBA for all inputs. Is that correct? Sorry if I missed the changelog, it’s been a while since I worked on GUI filters!

I don’t think so. It shouldn’t, at least.

Hmm this is very odd then, I made a test filter which simply does s c a x and everything appears with 4 channels. Tested with a single channel png and a 3 channel jpg.

I’ve tested a filter that just does display and I can have a 3-channels input.

How strange, display from a gmic_qt GUI filter yields a 4 channel window for me. My guess is user error… I’ll try to find out what I’m doing wrong…
CLI gmic is perfectly fine still.

That’s interesting (and unexpected :slight_smile: ). Let me know what you find out!

It gets even weirder - so if I either start with a specified image, or use the “Open” dialog, it’s always RGBA regardless of the input. If I use “custom code” to remove all then create a new RGB (then apply), it remains RGB for other filters. But if I use “custom code” to remove all and add a single channel image, I get an image with no content!

Edit: I have to go do other stuff for a bit now, will test in a windows VM later (as well as working on the translation)

1 Like

@garagecoder : The number of channels also depends on program with regards to GUI filter. Krita will always load it as RGBA32F multiplied by 255. Paint.NET will load with RGBA too. That’s why I’m careful with making gui version. Krita does output correctly regardless of end channel count from 1-4.

I’ve implemented two new things today:

  • [core-301] Make variable assignment operators as +=, -=, … evaluate their right-hand side as a math expression, without requiring it to be put between {}.

and

  • [core-301] New variable assignment operator :=, which evaluates the right-hand side as a mathematical expression. So, var:=expr is actually equivalent to var={expr}.

which means that in G’MIC 3.0.1, it will be possible to write:

a:=pi/2
a+=pi*cos(u)

which is equivalent to:

a={pi/2}
a+={pi*cos(u)}

but a bit more readable in my opinion.

3 Likes

It might take me some time to get used to the := syntax, but I think it’ll be better for me. I thought this was implemented already since I am using += outside of math evaluator, and it works.

Also, I would like to be able to retrieve target image dimensions from the GUI rather than preview width/height. Can that be looked at? As you know, I use G’MIC specifically for generative art, and this would be useful.

Added cli command gcd_resize_vw to resize images with variance weighted bilinear interpolation.

2 Likes

Added cli command gcd_median_transfer_curve to compute median mapped values between two images. Usage is identical to the existing command gcd_mean_transfer_curve.

1 Like

I’ve built new binary packages for 3.0.1_pre, now available from the website.
They include the new/modified variable assignment operators.

I’ve played a little bit with it, and I must say this is really great. It actually avoids to put a lot of {} in the source code. For instance, playing with variables containing the width and height of the last image can now be done like this:

W,H:=w,h
W,H+=10*[cos(u),sin(u)]

rather than

W,H={[w,h]} # or W,H={w},{h}
W+={10*cos(u)}
H+={10*sin(u)}

It should simplify the writing of commands even more.

1 Like

Aha, new package for “impish” as well which is exactly what I need :smiley:
Thanks, I’ll give this a try today!

Good update. I do stuff like the RHS all the time without thinking. Now, no more errors. :slight_smile:

What does RHS stand for?

RHS means right hand side.

1 Like

I’ve uploaded an update yesterday, because I found a serious bug in the new variable assignment system :frowning:
(just try : $ gmic var.=foo and see what the log message displays).