Release of G'MIC 3.2

This is the changelog for the release of the 3.2.0 version of the G’MIC software, released on 2023/01/16.

It lists all new features and changes done since the previous minor version 3.1.

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.2?

New features:

  • [gmic-qt-320] New filter Patterns / Pills renders a periodic pattern that looks like pills.

  • [gmic-qt-320] New filter Patterns / Halftone [Generic] implements a generic versatile algorithm for image halftoning, allowing various halftoning shapes.


  • [gmic-qt-320] Stand-alone version of G’MIC-Qt gets new option --layers to specify that multiple input images must be used as layers for the selected filters (rather than applying the filter image by image).

  • [gmic-qt-316] New filter Rendering / Algorithm A, is a G’MIC conversion of an interesting idea proposed by Memo Akten on Twitter. It creates abstract “Mondrian-like” illustrations.

  • [gmic-qt-316] New filter Arrays & Tiles / Shuffle Patches, allow to reconstruct images from shuffling the initial image patches, with different reconstruction options.


  • [gmic-qt-315] Filter Colors / Vibrance can be used to make your colors more saturated (filter done by @age).

  • [gmic-qt-315] Filter Colors / YCH Vibrance can be used to make your colors more saturated (works in th YCH colorspace). Filter done by @Reptorian .

  • [gmic-qt-313] New filter Rendering / 3D Mesh renders a 3D object on a new transparent layer, from a .obj (Wavefront) or .off filename.

  • [gmic-qt-313] New system for storing persistent data between successive calls of a filter, through new reserved variable $_persistent. Particularly useful for filter that input large external data files (e.g. that does not have to be reloaded each time the preview is updated).

  • [gmic-stdlib-320] Many improvements to the nn_lib (G’MIC neural network library): new losses cross entropy, softmax+crossentropy, binary crossentropy (classification losses), new modules conv3d (and variants), maxpool3d, patchdown2d/3d and patchup2d/3d + various improvements of existing modules, optimizations and bug fixes. As a test, the nn_lib has been able to train neural networks for classifying things (hand-written digits: MNIST dataset, clothes: MNIST Fashion dataset, faces, and others).

  • [gmic-qt-311] New filter Colors / Apply From CLUT Set allows to apply a CLUT on an image, from a compressed CLUT set stored as a custom .gmz file.

  • [stdlib-320] New command narg returns the number of passed arguments.

  • [stdlib-320] New command filename_dated converts specified filename to one stamped with the current date (such as filename_YYYYMMDD_HHMMSS.ext).

  • [stdlib-320] New command betti return the Betti numbers of selected 3D binary shapes.

  • [stdlib-320] New command to_automode converts an input image as an image with the minimal number of channels, without losing information. Useful to discard alpha-channel, or convert RGB images to GRAY, when possible.

  • [stdlib-316] New macro do_intersect(p0x,p0y,p1x,p1y,q0x,q0y,q1x,q1y) in math_lib: returns 0 (false) or 1 (true) whether the 2D segments [p0,p1] and [q0,q1] intersect or not.

  • [stdlib-316] New command ssim, computes the Structural Similarity Index Measure, as described in the paper: Wang, Zhou, et al., “Image quality assessment: from error visibility to structural similarity.”, in IEEE transactions on image processing 13.4 (2004): 600-612.

  • [stdlib-316] New commands mse_matrix, psnr_matrix and ssim_matrix return the matrix of resp. MSE, PSNR and SSIM values between images of the selection.

  • [stdlib-316] New command keep_named (shortcut kn) keeps only images with specific name in the image list (opposite of remove_named).

  • [stdlib-316] New command img2patches and patches2img: Command img2patches decomposes an image into a set of (possibly overlapping) patches, stacked along the z-axis. Command patch2img does the opposite. It reconstructs an image from its patch representation.

  • [stdlib-313] New command eye inserts an identity matrix of specified size at the end of the image list.

  • [stdlib-313] New command identity inserts an identity map with specified dimensions at the end of the image list.

  • [stdlib-313] New command surfels3d converts an image containing a binary shape as a 3D object containing 3D surfels (works for 2D images too).

  • [stdlin-313] New command input_obj implements a 3D mesh loader, in the .obj file format (Wavefront) (beware: not all .obj features implemented!).

gmic_000001

  • [core-320] Command text is now able to draw text using user-defined fonts.

  • [math-core-320] Functions crop() and draw() now have variants that respectively extract and draw images from/in a vector-valued variable.

  • [math-core-320] New functions gamma() computes the Gamma function of its real-valued argument.

  • [math-core-320] New predefined variable v, equivalent to u(-1,1).

  • [math-core-316] New function cov(A,B,_avgA,_avgB) computes the covariance estimation from two input vectors.

  • [math-core-316] New function mse(A,B) computes the mean-squared error between two input vectors.

  • [math-core-316] New function da_freeze(_#ind) convert a dynamic array as a 1-column image of size 1 x da_size(_#ind) x 1x100%.

  • [math-core-316] New predefined variable id stands for the standard deviation of the current image (eq. to sqrt(iv)).

Improvements / Changes:

  • [gmic-qt-320] Allow bool() parameters to have HTML codes in labels. Also swap widget ordering (label on the left, checkbox on the right).

  • [gmic-qt-320] Default interface layout is now set in “Dark Mode”, and “Preview on the Right”.

  • [gmic-qt-315] Make G’MIC-Qt compilation independent on G’MIC source code, when dynamic linking is set. This should ease the packaging of G’MIC into different components (requested by the Krita folks).

  • [gmic-qt-314] Filter 3D Mesh: Add rendering option Bounding Box.

  • [gmic_qt-313] Filter labels are now selectable and can be copy/pasted if necessary.

  • [stdlib-316] Commands mse and psnr have been recoded and return resp. the MSE and PSNR values of selected images with a reference image, passed as an argument.

  • [stdlib-313] Improve command output_obj : export face transparency; less memory used to export RGB materials.

  • [core-320] Improvement of the variable storage mechanism. Make things slightly faster, particularly for append/prepend assignments (var.=str and var..=str).

  • [core-320] Command camera now throws an exception if a camera frame could not be captured.

  • [core-320] Merge commands and math parser functions invert and pseudoinvert for matrix inversion.

  • [core-320] libgmic API has been cleaned. Classes gmic_image and gmic_list are now part of a new gmic_library namespace.

  • [core-316] Prevent warning on stderr when no display available (e.g., remote execution).

  • [core-316] Put back shotcut nm for command name.

  • [core-316] Improved how image copies are named in the image list.

  • [core-315] Improved the sharing of abort pointers between multiple parallel instances of G’MIC interpreters.

  • [core-313] Command warp: Make default value = 0 for argument 'boundary_conditions`.

  • [core-313] Optimize syntax +command for some arithmetic commands (e.g. sqr, sqrt, cos, …).

  • [core-313] Improve behavior of math function get(). Do not throw exceptions anymore.

  • [math-core-320] Optimize evaluation of math functions when expressions are simple.

  • [math-core-320] Add new option use_LU to command solve and math function solve().

  • [math-core-320] Functions stov() and vtos() renamed s2v() and v2s() respectively.

  • [math-core-320] Function u(min,max) has been extended to u(min,max,_include_min,_include_max) allowing to choose more finely if each range extrema must be included in the uniform distribution.

  • [web-316] Changes of URLs for the github repositories, now: GitHub - GreycLab/gmic: GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing and GitHub - GreycLab/gmic-community: Community contributions to the G'MIC software.

  • [package-313] Remove packages for versions of Debian and Ubuntu that are not supported anymore (Debian 9, Ubuntu 19.04, 19.10, 20.10, 21.04).

Bug fixes:

  • [gmic-qt-320] Fix saving output file in .png format with stand-alone version.

  • [gmic-qt-314] Fix encoding issue for filters returning encoded text in status, to modify input parameters.

  • [gmic-qt-314] Disable entirely the log output when verbosity is set to none.

  • [stdlib-320] Fix command texturize3d (a.k.a. t3d) when used on large 3D object (>2M primitives).

  • [stdlib-313] Fix command parse_cli when run without input data.

  • [stdlib-313] Fix command primitives3d for large 3d objects.

  • [gmic-qt-311] Fix management of “Faves” file on Windows, when the account name contains accentuated characters.

  • [core-320] Saving animated .gif now better handles alpha-channels (still requires IM convert to be installed on your system).

  • [core-320] Fix behavior of using break in a foreach...done loop (was behaving like continue).

  • [core-315] Fix possible double memory free, when exiting a filter.

  • [core-314] Fix regression in 3.1.3 that causes certain +command to be much slower than in 3.1.2.

  • [core-313] Fix macro value of cimg_max_buf_size that causes crash on 32-bits arch.

  • [core-313] Command rotate: fix argument parsing bug, happening with 3D rotations, when last argument center_z has a % suffix.

  • [core-313] Fix variable assignment operators >>= and <<=.

  • [core-313] Fix arithmetic variable assignment with rounding (e.g. x:=_pi).

  • [core-312] Fix bug in commands break and continue when executed in a loop that is the last code block of a command.

  • [core-311] Fix possible misinterpretation by the interpreter of arithmetic expression like ‘str1’==‘str2’, when used with the := assignment operator (commit #4200a80aae83b53d1a6d0e950f47e49601842d76)

  • [core-311] Fix blocking mutex when using nested run() in mathematical expressions.

  • [core-311] Fix regression that happened in command input_flo between version 3.0.2 and 3.1.0 (wrong datatype name used).

4 Likes

Might want to add that blend has changed. Should we change the code on gmic-community with regard to blend?

blend has changed indeed. Old version was not accurate and even buggy in some cases (like blending a foreground wo/ alpha on top of a background w/ alpha).
The syntax of the new command is the same though, so changes shouldn’t be needed unless you were using blend in a way that exhibited the wrong behaviors.

Bonjour,

In the ‘new blend’ two modes are missing :

  • seamless
  • seamless_mixed

Fixed with: https://github.com/dtschump/gmic/commit/c05065d448dcbfb88b3f18b95da4f9207f8b9228

Merci :o)

Suggestion: Add new G’MIC-QT codes filters specifically for full-sized preview.

See gui_crop_preview , gui_resize_preview, gui_crop_resize_preview.

I was thinking of code[Global] and code[local], but I will see to that.

EDIT: Copying code[local], and then adding an asterisk works for me. Now, I can figure out how to do point-based crop.

And I figured it out:

 point_x,point_y:=cut([$1,$2],0,100)
 
 eval "
  points=[$point_x,$point_y]%;
  trim_out_width=min($_preview_width,w);
  trim_out_height=min($_preview_height,h);

  trimmed_width=w-trim_out_width;
  trimmed_height=h-trim_out_height;

  x0=int(trimmed_width*points[0]);
  y0=int(trimmed_height*points[1]);
  x1=x0+trim_out_width-1;
  y1=y0+trim_out_height-1;

  [x0,y0,x1,y1];"
  
  crop ${}

Hi, I used GMIC QT in krita and found a possible mistake. Amyspark said it was stipulated by GMIC internally, so I came here to give feedback.

The “HSV” mode of “channels to layers” can divide the layer into two parts, and use the “value” blending mode in krita for mixing. However, this result is different from the original figure. Instead, it is more correct to use “multiply”.
舒服垫 (artwork by 藤ちょこ)
Is this the wrong setting of blending mode or the wrong processing of channels? I remember that other software does not have “value” blending mode. Maybe just change the blending mode to “multiply”.

@TheTwo85737309 Welcome to the forum! Recently, there were changes to blend filters / commands that may improve things for you. I suggest you update G’MIC qt and then the filters so we can be on the same page.

Did you draw this image? If not, please give attribution.

I think the problem is related to the slight differences between how blending modes are implemented in the different hosts that support G’MIC-Qt.
When I’ve implemented this filter, I’ve tried it on GIMP and it gave the same kind of result with the “Value” mode, as implemented in GIMP then.

Anyway, I can still add a new option to HSV mode with the “Multiply” mode if needed.

I tested it in krita and gimp: most cases are the same, but krita changes saturation in some cases. This should be the reason why they are different. I think gimp is more correct. So I will also report to krita developers.

It may be more convenient to unify the blending mode of all softwares into “multiply”: otherwise, Photoshop, affinity photo and other software cannot find “value”
imagekrita
imagegimp

Looks like G’MIC ignores Alpha and for the most part it does. To my understanding Alpha is a big part of Krita but optional in GIMP.

I know this is pretty obscure request, but could it be possible to add a variable named 'color_restriction' to 'index', and what it does it attempt to limit to nearest colors of n size within palette?

See G’MIC exercise thread.

Two things to consider:

  • As you said, this looks like an “exotic” request, i.e. something that will be used only by you and maybe 1 or 2 other people in the whole G’MIC lifetime → this is not a good sign to ask for a feature integration in the G’MIC core :slight_smile:

  • Why not implementing it by yourself using the math parser ? This is totally doable as a custom command. For instance, a simplified version of index could be written as:

#@cli my_index : [palette]
my_index :
  pass$1 0
  foreach[^-1] {
    pass.
    [0],[0],[0],1,"
      RGB = I(#0);
      dR = crop(#1,0,0,0,0,w#1,1,1,1) - RGB[0];
      dG = crop(#1,0,0,0,1,w#1,1,1,1) - RGB[1];
      dB = crop(#1,0,0,0,2,w#1,1,1,1) - RGB[2];
      index = argmin(sqrt(dR^2 + dG^2 + dB^2));
    "
    k.
  }
  rm.

(it even runs in parallel).
Feel free to add whatever additional constraint you want on the computed index

Hello, I have one more thing. A dozen of us spent some time before making the Chinese translation of GMIC QT, which is roughly as shown in the figure below (Chinese + English). Can it be merged? In fact, my friend has submitted it before, but no one replied
Submission of Chinese translation documents by PTFish8 · Pull Request #127 · c-koi/gmic-qt (github.com)

2022/05/10: Release of version 3.1.1.

1 Like

New critical bug found tonight :frowning: Will release fix 3.1.2 tomorrow!

1 Like