On the road to 3.0

Here I will write about the advances made from latest stable version 2.9.0 to next major version 3.0.0. Right now, I expect mainly bug fixes and a few new features (but the less native possible, to keep compatibility with 2.9.x).

From 2.9.2 to 2.9.3

New features:

  • [gmic-qt-293] New filter: Degradations / Rebuild From Blocs. It subdivides an image into blocs, and replace each bloc by the most similar bloc found in the set of other blocs.

  • [gmic-qt-293] New filter: Degradations / Blur [Multidirectional].

  • [math-core-293] New function expr('formula',_w,_h,_d,_s) outputs a vector of size w*h*d*s with values generated from the specified formula, as if one were filling an image with dimensions (w,h,d,s).

  • [math-core-293] New function get('varname',_size) returns the value of the specified variable, as a vector of size values, or as a scalar (if size is zero, or not specified).

Improvements / Modifications:

  • [core-293] External calls to ImageMagick’s convert are better managed on Windows, when filename or path contain spaces or UTF-8 characters.
  • [core-293] Command resize: Argument list as [image],_interpolation,_boundary_conditions,_ax,_ay,_az,_ac is not permitted anymore, because it can be ambiguous compared to [image],_height,_depth,_spectrum,_interpolation,_boundary_conditions,_ax,_ay,_az,_ac. New command resize_as_image (eq. to ri) replaces the use of the deprecated argument list.
  • [stdlib-293] Command convolve_fft now accepts an optional boundary_condition argument.


  • Command +e and +warn: Avoid first undesired line-feed character put on stdout.
  • Command convolve_fft has been recoded and is more precise and fast now.

From 2.9.1 to 2.9.2

New features:

  • [gmic-qt-292] New plug-in filter Artistic / Doodle creates doodles from input photographs.


  • [core-292] New native command mproj (stands for matrix projection) computes the projection of a matrix into a prescribed dictionary (defined as another matrix), with the choice of various projection methods : ortho-projection, matching pursuit, and orthogonal matching pursuit. Useful stuff for sparse dictionary learning. Math evaluator gets an equivalent mproj() function as well.

  • [math-core-292] New pre-defined variables in and in#ind return the L2-norm of respectively current image and image #ind, viewed as vectors or matrices (in that case, the Frobenius norm). Corresponding function in(_#ind) does the same for images with dynamic content (e.g. images under modification).

  • [stdlib-292] New commands xyz2jzazbz, rgb2jzazbz, jzazbz2xyz and jzazbz2rgb convert RGB or XYZ colors to the Jzazbz colorspace (and vice-versa). Code for these commands has been borrowed from this page by Alan Gibson (@snibgo).

Improvements / Modifications:

  • [core-292] Remove support for deprecated double-hyphen prefix (--command). Use +command instead.

  • [core-292] A few internal functions for matrix calculus have been better parallelized, when applied on large matrices (multiplication, norm, dot product, …).

  • [core-292] Command invert accepts an optional argument to choose between different solver for matrix inversion (can be 0=SVD or 1=LU). SVD solver is slower for large matrices, but less numerically instable. Math evaluator functions invert() and pseudoinvert() also gets this optional argument.

  • [core-292] Commands fill and eval better manage auto- or forced parallelization when image has a few columns.

  • [core-292] Commands solve, invert, svd, trisolve and blur : use double precision for computation.

  • [core-292] Command object3d: Add modification in a 3D object format to define a perfect sphere primitive from a pair (center,point), rather than specifying it only with its diameter (point1,point2).

  • [core-292] Command +echo is now implemented as a native command (faster).

  • [core-292] Command echo better manages messages starting with CR character.

  • [core-292] Commands discard and split : When possible, preserve principal axis of processed images.

  • [core-292] Command label: Change output behavior in order to manage multi-channels input images, and output always a single-channel label image even when a multi-spectral input image is given.

  • [core-292] Command label: New argument to choose between L1 and L2-norms for tolerance comparisons.

  • [math-core-292] Function transp(), inv() and pseudoinv() have been renamed respectively as transpose(), invert() and pseudoinvert() to be more coherent with the name of the corresponding pipeline commands.

  • [stdlib-292] Remove useless command unrepeat (eq. to discard without arguments).

  • [stdlib-292] Add illuminant E as a possible choice for color conversion commands involving the XYZ colorspace. Set it as default illuminant when no explicit illuminant is specified.

  • [install-292] Ubuntu/Debian packages provided on the G’MIC website now add an entry to the Desktop menu with the stand-alone version of G’MIC-Qt and ZArt.


  • [core-292] Math evaluator: Fix possibly wrong pointer in call to delete.

  • [core-292] Command solve: Fix compilation issue when Lapack support is enabled.

  • [stdlib-292] Filter Apply External CLUT: Implement Strength control.

  • [stdlib-292] Fix command colormap, for some degenerated cases.

  • [gmic-qt_292] Fix possible canvas shift when applying a filter inside a selection.

From 2.9.0 to 2.9.1

New features:

  • [gimp-qt-291] New filters Various / Import RGB-565 File and Various / Export RGB-565 File allows to import/export data from raw RGB-565 files.


  • [gimp-qt-291] New API feature allowing to hide unused items or comboboxes for hosts that don’t implement all the plug-in features.

  • [core-291] New command remove_named (shortcut rmn) removes images with specified names from the list (equivalent to rm[${"-nmd name"}]).

  • [core-291] Interactive 3D viewer (command display3d, a.k.a d3d) has been recoded from scratch as a custom command.

  • [core-291] New substituting expression {*,f} returns 0 or 1 whether the display window is in fullscreen mode or not.

  • [math-core-291] New function swap(a,b), swaps the values of given arguments a and b.

  • [math-core-291] New functions vargkth(), vargmin(), vargmax(), vargminabs(), vargmaxabs(), vavg(), vkth(), vmin(), vmax(), vminabs(), vmaxabs(), vmed(), vprod(), vstd(), vsum() and vvar() are similar to the functions whose names do not start with v, but works with vector-valued arguments (and return a vector-valued result).

  • [math_core-291] New function string() creates a string from a list of arguments (similar to echo() but outputs a vector).

  • [stdlib]-291] New command rbf computes interpolated 1D/2D/3D functions from a set of sparse keypoints.

  • [stdlib-291] New command percentile applies a “percentile filter” to selected image (mix between averaging and dilate/erode/median).

  • [stdlib-291] New commands input_565 and output_565 allows to read/write images files in raw RGB565 format.

  • [stdlib-291] New command is_macos returns 1 or 0 whether G’MIC is run on MacOS or not.


  • [core-291] Commands solve and invert now runs in parallel when possible (also apply for functions solve() and inv() in the math parser).

  • [core-291] Special input string (value1{,|;|/|^}value2{,|;|/|^}...[:{x|y|z|c|,|;|/|^}]) has now an optional :axis option to unroll the image values along a specified axis.

  • [core-291] Slightly improved the memory footprint of the G’MIC interpreter. A few memory allocations are avoided when not necessary.

  • [core-291] Variable font size are now used in interactive viewer when displaying a list of image (command display), in order to make it readable on HDPI screens.

  • [core-291] Optimize commands isoline3d and isosurface3d, by lowering the number of grid points evaluations.

  • [core-291] Better support UTF-8 paths and filenames on Windows.

  • [core-291] Command uncommand now has a shortcut name um.

  • [math_core-291] Add a pre-optimization step that detects common simple expressions for speeding up evaluation for these cases.

  • [math_core-291] Change encoding of unsigned int values in functions f2ui() and ui2f(), so that no subnormal float numbers are used for the encoding. This avoids issues for commands dealing with large 3D objects, when aggressive optimization flags are used for compiling gmic (which is the case by default).

  • [math_core-291] Improve syntax for accessing a vector component, where the left side of the [] operator is complex. For instance, I[#0,off][2] is now recognized (needed parentheses before, i.e. (I[#0,off])[2]).

  • [stdlib-291] Command display2d: font with adaptive size is now displayed in order to deal with hidpi screens.

  • [stdlib-291] Command display2d: hexadecimal display of color values is now enabled for 1,2,3,4-channel images (not just 3 as before).

  • [stdlib-291] Command sort_list has been optimized when used with the n type of sorting.


  • [core-291] Fix a few (critical) OpenMP issues with clang++ compiler.

  • [core-291] Fix possible buffer overflow happening when reading some malformed .bmp files.

  • [core-291] Substituting expressions s.a. ${"command"} now checks that the provided command does not change the number of images in the list, and throws an error otherwise (was possibly leading to segfaults, e.g. sp lena +b 10 d ${"max u 10"} ).

  • [core-291] Fix argmax command and argmax() function in math parser (regressions introduced in 2.9.0).

  • [math_core-291] Fix modulo function when called with inf or nan values.

  • [math_core-291] Fix function isint() when passing NaN or inf values.

  • [stdlib-291] Fix filter Artistic / Cutout (regression of 2.9.0).


– FYI, Apple dropped the X. It is now macOS.
display0 no longer shows stats like other display modes.
sqr() function missing in docs.

Hello everyone

I was replying to a post on this forum about an user request to reduce red-eyes:

In order to help this user I have downloaded from Internet a picture with the problem (red-eyes, I mean) :slight_smile:
I have discovered that with this very particular PNG image the G’MIC 2.9 GUIs is not available with GIMP 2.10.18 (Windows 10 - 64 bit). It is greyed out and you can not click on it.

The 2.9 CLI version of G’MIC works fine with this same image. Therefore I don’t know whether it is a “bug” of GIMP or G’mic (Qt graphical version…).
As reported this problem occurs only with this png file. The other PNGs images work fine in that the GUIs is always available with GIMP.
In addition, if I save this same image as jpeg the G’MIC plugin is working on GIMP.

Here is the image:


This .png is not in RGB mode, but uses indexed colors. In GIMP, go to ‘Image -> Mode’ and select ‘RGB’ to be able to open the G’MIC plug-in.

Hello @David_Tschumperle

This .png is not in RGB mode, but uses indexed colors.

I would have never thought about that :slight_smile:

Just tried again your suggestion. It works great now!
Thanks a lot indeed!

Hi, nice progress with display3d as custom command. Still actually, on my Mac I get an error

gmic osteo elevation3d 0.2
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Load osteoblast nucleus example image
[gmic]-1./ Build 3D elevation of image [0], with elevation factor 0.2.
[gmic]-1./ Display 3D object [0] = ‘osteo’ (16384 vertices, 16384 primitives).
[gmic] *** Error in ./display3d/_display3d/(…)/*if/boundingbox3d/*repeat/*local/ *** Item substitution ‘{o3d.>0}’: Unrecognized item ‘o3d.’ in expression ‘o3d.>0…’.

It disappears with
gmic m work/src/gmic/src/gmic_stdlib.gmic osteo elevation3d 0.2

There is seemingly a mismatch between cmic_stdlib.gmic and update291.gmic

Indeed, I’ve just noticed that boundingbox3d was already defined as a command in jerom_boulanger.gmic (from @Jerome_Boulanger , with a different way of using it.
I’ll see what I can do to fix that.

Very good. Still I have a problem to add a background image. I tried

gmic m work/src/gmic/src/gmic_stdlib.gmic osteo elevation3d. 0.2 follic d3d… .

Are there any conditions for the background image?

Actually, I didn’t take care of the previous list of possible arguments for d3d.
I’ll manage them ASAP.

Bug or misunderstanding?

gmic (-28) (-14) +argmin +argmax.. # unexpected (argmax!=1)
gmic (28) (14) +argmin +argmax.. # expected

gmic (-28) (-14) +argmin +argmax.. # unexpected (argmax!=1)
  • The first +argmin is equivalent to +argmin[0,1] and returns then (0) as -28<-14.
  • You have then a list of 3 images : (-28), (-14) and (0).
  • The +argmax.. is then equivalent to +argmax[1] and returns (0) (obviously , there is only a single image in your selection, so 0 is the only possible value that can be returned by your argmax).

I’m not sure what you wanted to compute with your argmax, actually.

Typo. The same result comes from

gmic (-28) (-14) +argmin +argmax[0,1] e[] {2,i},{3,i} q # 0,0

That is more unexpected indeed. Will investigate this tonight :slight_smile:

That was a bug indeed! I’ve fixed it.
I guess nobody should use argmax until the next release 2.9.1… :frowning:

I have a large list of images. If errors appear anywhere in this list it is quite difficult to trace that. Especially if the error appears only inside the long list processing and not on the finally isolated image. In fact I had a crash of such sort setting a parameter with or without “%” and could not prepare information to trace that bug. Hence I could not send a bug report.

I think some sort of break, debug or stop/continue function inside the actual environment allowing to insert and process additional gmic commands would be very helpful.

I don’t really understand what you mean here. Do you have a simple example of code that reproduce your issue?

That is just the problem. I had some 300 images calculated in a sequence and one, say the 170th delivered a crash. However trying this image alone with the same sequence, there was none. I could not isolate a small piece of code with the issue.

What kind of crash ? Did you get any error message ? What was the command applied ?

I cannot reproduce it now!

Message was

[gmic] G’MIC encountered a fatal error. Please submit a bug report, at: https://github.com/dtschump/gmic/issues

The last image processed was an extracted region, actually the “L” channel from “rgb2lch”,

[14] = ‘trans_c1’:

size = (1,367,1,1) [1468 b of floats].

data = (94.0206;94.1174;93.8031;94.2977;92.6694;91.849;92.816;93.6015;92.8939;91.4756;91.1697;91.581;(…),92.3684;94.1638;92.2279;89.4571;89.2402;91.0791;92.9231;91.7553;90.0086;90.1253;91.3168;93.0702).

min = 81.0405, max = 99.4728, mean = 92.1273, std = 3.58977, coords_min = (0,169,0,0), coords_max = (0,284,0,0).

and the command was “karo_extinction. ,” which defaults to 100%

The crash disappeared with “karo_extinction. 100”

In the meanwhile (continued work), there is no crash anymore neither with 100% nor 100

Sorry not to be more specific!

The first occurrence was:

/Users/karo $ gmic bh_praep ,,,,269
[gmic]-0./ Start G’MIC interpreter.

[gmic] G’MIC encountered a fatal error. Please submit a bug report, at: https://github.com/dtschump/gmic/issues

“bh_praep” is a custom function from me, processing a set of images with lots of called other functions.