Release of G'MIC 2.2.0

This is the changelog for the release of the 2.2.0 version of the G’MIC software.

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.

Enjoy !

What’s new in version 2.2.0?

New features:

  • [core-220] Math parser gets a new function fsize(filename) which returns the size (in bytes) of the specified filename.

  • [gmic-qt-220] New filter Details / Equalize local histograms is yet another filter based on local histogram equalization to bring out the details in images.

  • [gmic-qt-220] New filter Arrays & tiles / Drawn montage allows to create photo montage quickly, just by drawing the montage layout with color shapes on a top layer. The filter then automatically resize and move the layers to fit the montage layout.

  • [stdlib-220] Command math_lib gets new macros available in the math parser, to draw shaded triangles and quadrangles in images.

  • [gmic-qt-220] New filter Deformations / Crease.

  • [gmic-qt-219] New filter Colors / Equalize HSI-HSL-HSV allows to apply offsets to hue,saturation and intensity/lightness/value for different image tones. This filter has been created in collaboration with our friend David Revoy.

CC-By David Revoy/

  • [gmic-qt-219] New filter Details / Magic details proposes a new algorithm to make the details pop-up in a photograph, either slightly or in a more aggressive over-HDR-style!

  • [gmic-qt-219] New filer Rendering / Gear let you generate gears with different shapes.

  • [stdlib-219] New commands uchar2str and str2uchar which can be used to encode an image of unsigned char values into a string, and decode it afterwards. Useful to store binary data as a compact form in G’MIC scripts.

  • [gmic-qt-218] New filter Degradations / Streak generates a pixel stretching effect on a given user mark:

  • [core-217] Some evolutions in math parser:

    • New function stats(#ind) returns the statistics vector of running image #ind.
    • New function avg(val1,val2,...) returns the average value of specified arguments.
    • Functions xm(), ym(), zm(), cm(), xM(), yM(), zM(), cM(), im(), iM(), ia(), iv(), is(), ip() has been removed, as they can all be replaced by stats().
    • Function gcd(a,b) returns the greatest common divisor between a and b.
  • [stdlib-217] New command linify takes an input image and generates a render of the input with only colored lines. It implements roughly the algorithm described on this page.


  • [stdlib-217] New command slic generates a partition of an input image into super-pixels, using the SLIC algorithm.

  • [stdlib-217] New command run just executes the G’MIC pipeline given as the command argument. Useless, except when used from a shell (e.g. bash) to prevent bash substitutions using quotes, like in the example below:
$ gmic run 'repeat 10 echo $> done'

instead of having to write:

$ gmic repeat 10 echo "$>" done
  • [gmic-qt-217] New filter Contours / Super-pixels generates image partition using the slic command:

  • [gmic-qt-217] New filter Artistic / Linify renders an input image with only plain lines.

  • [gmic_qt-217] New filter Patterns / Satin renders a satin-like texture image from scratch.

Modifications / Improvements:

  • [core-220] Loading and saving of .yuv video files now allows to choose the type of chroma subsampling (can be 4:2:0, 4:2:2 or 4:4:4).

  • [core-220] Slightly improved the interactive display, by allowing zooming of a 3d volumetric image (with crop or mouse wheel) so that the zoom is only performed in the considered plane (x,y), (x,z) or (y,z).

  • [core-219] Most source files of the G’MIC core are now dual-licensed CeCILL-C (LGPL-like) or CeCILL (GPL-compatible). This means using the G’MIC library is now allowed in closed-source software as long as modifications done on the source code is given back to the community. Note that this licensing change does not concern the code of the GTK or Qt plug-in, but only the core functionalities (the G’MIC script interpreter and the implementation of the filters).

  • [gmic-qt-219] Important restructuring and cleaning of the plug-in code, which fixes several small inconsistencies in the use of the GUI :

    • New option in preferences to hide/display the institution logos.
    • New option in preferences to set the preview timeout.
    • New location of the input/output parameters, now under the filter parameters to maximize the size of the preview window.
    • Add a vertical splitter between filter parameters and in/out parameters to be able to reduce the size of the in/out panel if needed.
    • Add a reset button for the in/out parameters, so that they can be reset to default values.
    • Improve logging behavior.

  • [core-219] Optimized the image construction from a list of values (e.g. input (1,2,3,4)), now running x5 faster.

  • [core-218] Math parser functions echo() and ext() now convert scalar arguments into a string representation of the number rather than a single character. Allows to simplify a syntax such as ext('blur ',vtos(alpha)); as ext('blur ',alpha);

  • [core-217] Command name now accepts several arguments to rename multiple image with different names at the same time, e.g. name[0,1,2] first,second,third.

Bug fixes:

  • [core-220] Fix bug when using function ext() in math parser that raises an exception.
  • [core-219] Fix bug in command unserialize: unserializing buffer without compression was sometimes not working as expected (leading to issues in command cast).
  • [gimp_qt-218] Fix zero filter issue in the plug-in when launched without connection to the Internet.
  • [core-217] Fix command median when used with a threshold on an image containing inf values.
  • [gimp_qt-217] Fix a few parsing bugs happening in case of incomplete filter parameters.
  • [gimp_qt-217] Take ‘silent’ filter parameters into account (parameters that do not trigger preview re-computation when value is changed).
  • [gimp_qt-217] Pressing the Cancel button when a filter preview is currently rendering now quits the interface.

I wish I can update gmic in Krita and GIMP 2.9 CCE. I’m stuck on 2.1.3 for both.

You can compile from source!

I think I’ll just wait for 2.2.0

OK; I can appreciate rendering satin; looks like a great preset for this, David. Cool stuff. :slight_smile:

The new Equalize HSI-HSL-HSV filter is very interesting, need to test it more but with some time spent it does the job, did not achieve something as good as the illustration pictures for now tho, this one is really impressive.

I’m wondering if this is possible somehow in G’mic :
-Set our parameters to colorize a W&B picture with this filter and get as an option a HaldClut file output created based on the changes made with the filter so we can apply this easily on a larger scale or apply it to a short grayscale animation video.

I’m not sure if it’s something that is possible to be done or could be considered to be added as an option to this particular filter but it crossed my mind while playing a bit with the filter.

Maybe it will need a default color scheme haldclut > then have the colors scheme from the picture we want to modify applied to it and finally the color changes done with the filter applied to it ?

While i’m at it:
Is it possible with G’mic to generate a haldClut file directly from a picture based on the colors used in the picture ? Generating directly a Haldclut from a picture somehow. Not really sure if such thing i possible or not but will be neat.

PS: Also thanks a lot for the UI changes in the last version, great addition with now a maximized preview window.

Thank you very much for all the shinny things you bring us in G’mic.

I need the magic details.:genie: Where does the magic come from?:thinking: How did it come to inherit such a name?:mage: Where is cupid? Where is the heart? Are only gears important?:roll_eyes:

Thanks for the updates!

1 Like

Congrats to the team, those new filters look really interesting!

1 Like

Nope, the filter is a bit more complex than just applying an HaldClut to a color image, as it also requires some kind of subtle spatial smoothing (and that is an important part of the filter!).
Anyway, if you want to apply this filter on a video, why not using G’MIC command-line tool directly ? Command apply_video is precisely done for that kind of tasks.
I’d say something like :

$ gmic apply_video filename.avi,\"fx_equalize_hsv_preview 1,100,0,22.14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0,0,0,0,0,-1,0,0\",0,-1,1,output.avi

will do the job for you.

  • There already was ‘mighty details’ and ‘freaky details’, so I’ve been running out of ideas :slight_smile: (and this has nothing to do with ImageMagick…)
  • Cupid and heart filters are still there, at least I seem them in the ‘Rendering/’ section :slight_smile:

Felt like being goofy.

  • Could you share the details of how you arrived at the algorithm of the magic details filter?
  • Gears listed in the changes but not cupid or the heart :crying_cat_face:. BTW cupid looks a bit rough.

Basically, the idea is to increase the local variance of the pixel values. ‘Locally’ here means that the neighboring pixels are considered along different shapes depending on the local geometry around each pixel.
Mathematically speaking, increasing variance means doing something like avg + (i(x,y) - avg)*factor where avg is the average of the pixel values in the neighborhood of pixel (x,y).
avg can be thus obtained with a local smoothing, and doing it smartly imposes a non-linear edge-preserving smoothing. I chose to use bilateral filtering in this case, which has good edge-preserving properties and which is quite fast to compute.
Now, factor has to be chosen to be >=1 and even better can be chosen differently for each pixel. This is what I do by making factor depend on a power (positive or negative) of the image gradient norm,. So, I can decide to boost the variance preferably for pixels that are already on contours, or on the contrary, pixels that are located in more homogeneous regions (textures for instance). That is precisely what the ‘Edges’ slider is aimed for.

Cupid and Heart have been already there for a long time. Or did I miss something ?

Also, just look at the code for the Magic details filter. It is quite simple, and does what I explained:

#@gui Magic details : fx_magic_details,fx_magic_details_preview(0)
#@gui : Amplitude = float(6,0,30)
#@gui : Spatial scale = float(3,0,10)
#@gui : Value scale = float(15,0,20)
#@gui : Edges = float(0.5,-3,3)
#@gui : Smoothness = float(2,0,20)
#@gui : sep = separator(), Channel(s) = choice(27,"All","RGBA [all]","RGB [all]","RGB [red]","RGB [green]","RGB [blue]","RGBA [alpha]","Linear RGB [all]","Linear RGB [red]","Linear RGB [green]","Linear RGB [blue]","YCbCr [luminance]","YCbCr [blue-red chrominances]","YCbCr [blue chrominance]","YCbCr [red chrominance]","YCbCr [green chrominance]","Lab [lightness]","Lab [ab-chrominances]","Lab [a-chrominance]","Lab [b-chrominance]","Lch [ch-chrominances]","Lch [c-chrominance]","Lch [h-chrominance]","HSV [hue]","HSV [saturation]","HSV [value]","HSI [intensity]","HSL [lightness]","CMYK [cyan]","CMYK [magenta]","CMYK [yellow]","CMYK [key]","YIQ [luma]","YIQ [chromas]")
#@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right")
#@gui : sep = separator(), note = note("<small>Author: <i>David Tschumperl&#233;</i>.      Latest update: <i>2018/01/10</i>.</small>")
fx_magic_details :
  ac "_fx_magic_details ${1-5}",$6,1

_fx_magic_details :
  repeat $! l[$>]
    +bilateral $2,$3
    +gradient_norm.. +. 1
    pow. {$4>=0?3.1-$4:-3.1-$4}
    b. $5 n. 1,{1+$1}
    -... .. *[-3,-1] + c 0,255
  endl done

fx_magic_details_preview :
  gui_split_preview "fx_magic_details $*",$-1

Oops, I just noticed them while browsing the stdlib and thought that they were new :blush:.

It is not so simple to me, so thanks for explaining it to me.

Hi ,
thanks for the answer, i understand now it can’t be done, and thank you for the tip,
i rarely used it in command line and did not even knew about the apply_video option.

After a few tries i have problems to make this work, i am under win7 and a few searches seems to indicate i am not alone having troubles with this function of the CLI.

Tried with a .mp4 file, then same file converted into .avi or .mkv etc… and no dice.

Command i used + output in command prompt console ( ends up in a 0kb output.avi file created ):

H:\gmic>gmic.exe apply_video test.mp4,\"fx_equalize_hsv_preview 1,100,11.46,9.28,0,0,0,0,0,0,0,41.4,

[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Apply command 'fx_equalize_hsv_preview 1,100,11.46,9.28,0,0,0,0,0,0,0,41.4,0.22,0,35.28,0
.24,0,0,0,0,0,0,0,38.52,0.32,0,-105.48,0.56,0,180,-0.55,0,0’ on input video file ‘test.mp4’, with fi
rst frame 0, last frame -1, frame step 1 and output filename ‘output.avi’.
[gmic]-0./ End G’MIC interpreter.

Tried to see if Gmic was recognizing my videos using the is_videofilename command and this is what i get :
H:\gmic>gmic.exe test.mp4 is_videofilename
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Input all frames of file ‘test.mp4’ at position 0
[gmic]-0./ *** Error *** [instance(0,0,0000000000000000)] CImgList::load_video(): File 'test.
mp4’, unable to detect format of video file.

Was super excited when i saw your answer and the possibility to apply Gmic filters into videos directly, but after spending a bit of time testing and searching it seems that windows and this function aren’t pairing well.

Will try a bit more in the next days, maybe using different video formats for input or other filters too while i’ma at it but for now it seems i’m stuck.

Thanks again for all.

Ha yes, maybe this is another issue on Windows. Video input/output is managed by the OpenCV library, and while it is working quite well on Linux, it seems to work randomly on Windows.
A solution would be to decompose your video file into several .png frames, then use the similar command apply_files to process them, then recompose the video afterwards.

1 Like

That’s my plan, at least for a short animation movie in grayscale colors, I’ll probably use avisynth+ to export all frames, then make a small .bat file to apply the filter on all them with the CLI and re-import them back into avisynth+ for a bit of post-processing before encoding the final output video.

Never heard of OpenCV before starting to search a bit when i first encountered the problem, for what i saw, mostly on this forum, this windows problem with videos in gmic ain’t gonna be solved anytime soon so i will just have to forget about it i guess.

Too bad as when i discovered it was possible for gmic to work with videos input it gave me a lot of ideas for videos and all the nice filters gmic offers, for short ones working with decomposed video into frames will work without much trouble, for longer and higher resolution videos it will be probably quite heavy to do this.

I’ll give some tries during the next weeks and see what i can do, this particular plugin seems like a good opportunity to try colorizing some old grayscale cartoons ^^

Thank you again for all the help.

Maybe a simpler approach for long videos would be to install Ubuntu +G’MIC on a VM, then use it from the command line on the virtualized linux.
Probably not very long to set up, and more efficient than having to decompose videos into frame pictures !

Yes, it is something I’ll have to explore and take time to set up to make things easier i guess, no other choice since applying filters in videos seems to not work at all under windows, for now i’ll experiment with short videos and the frame extraction when i’ll have a bit of free time as it can can be automated a bit and not give much troubles, but for heavier projects i’ll have to dig into Linux world in a virtual machine most probably.

Thanks again for your precious help.

A very little thing could be very nice with Gmic-Qt: keeping zoom ratio, location previewed, preview type, channels when trying 2 or more filters. And maybe keep user-default I/O parameters?

  • Today is release day ! :wink: