G’mic: The command line behind the Gimp plug-in

0-Expendable introduction

The G’mic plug-in for Gimp is based on the G’mic language. Each filter proposed in the plug-in corresponds to a G’mic command line, each setting is just a parameter of that command line. And command lines are great because :

  1. it is a way to remember settings and filter sequences,
  2. it allows to (almost) effortlessly apply on a large set of images what you just did graphically.

Anything said below supposes that you run some kind of linux, but the spirit of it apply under other OS too.

1-How to get the command lines?

To have the plug-in tells you what you do graphically in the command line language, you just have to start Gimp from a terminal and to set it to “verbose mode”.

To start from a terminal, just open a terminal and type :


To set it to “verbose mode”, once you have open the plug-in, set the “ouput messages…” menu on the left to “Verbose”.

From now on, you’ll see text appearing in the terminal each time G’mic adapt the preview to your new setting and each time you apply a filter on your image.

Image from PhotoComiX, CC-by-nc

2-What it looks like?

Two kind of lines appear in the terminal. The ones telling what command is used to create the preview (containing the /preview/ sequence) and the ones telling what command is really applied on the picture (containing the /apply/ sequence). You are probably only interested in the last kind.

For example, the line:

[gmic_gimp]./apply/ -v -99 -gimp_mix_rgb 1,0,0,1,0,0,1,0,0,0,2,0

tells that the command called was gimp_mix_rgb and all the numbers behind correspond to the settings.

3-What to do with it?

You could just be happy to know what happens and to be able to keep everything in a text file with a simple copy/paste, but you could also want to apply it in a terminal. Just go to the directory where your file (say image.jpg) is and type:

gmic image.jpg -gimp_mix_rgb 1,0,0,1,0,0,1,0,8.5,0,2,0

Your processed image will be displayed, but not saved.
To save it instead of displaying it:

gmic image.jpg -gimp_mix_rgb 1,0,0,1,0,0,1,0,8.5,0,2,0 -o processed_image.jpg

If you have many images (whose names finish by jpg) that you want to be processed, a script like that should do it:

for i in *jpg
gmic $i -gimp_mix_rgb 1,0,0,1,0,0,1,0,8.5,0,2,0 -o processed_$i

Image Wikimedia

4-By the way

If you only want the “interested” lines to appear in your terminal, you should run Gimp with this command instead:

gimp |grep apply
    • David
    • June 16th, 2014

    I followed these instructions and was able to get it to work for -gimp_mix_rgb, but when I try it with -gimp_graphic_boost4 I get this error message:
    [gmic] *** Error in ./ *** Unknown command or filename ‘-gimp_graphic_boost4’

    • This is because graphic_boost is an external filter, one that you got by updating you filters in the plug-in.

      You can use it by updating your filters in the command line too:
      gmic -update -gimp_graphic_boost4

      By the way, this blog should not exist anymore, all the the G’MIC wiki contains much more and is much more up to date.

      And your questions might be better faster answered on Flickr.

        • David
        • June 17th, 2014

        Thanks much. I’ll head over to Flickr, but thought I would also reply here. I tried what you suggested, but got these messages:

        gmic -update -gimp_graphic_boost4
        [gmic]-0./ Start G’MIC parser.
        [gmic]-0./ Update commands from the latest definition file on the G’MIC server.’
        curl.exe’ is not recognized as an internal or external command,
        operable program or batch file.
        ‘wget.exe’ is not recognized as an internal or external command,
        operable program or batch file.

        [gmic] *** Error in ./update/_update/ *** cimg::load_network_external(): Failed
        to load file ‘http://gmic.sourceforge.net/update1592.gmic’ with external tools ‘
        wget’ or ‘curl’.

  1. I see that you use windows. Wget and Curl are 2 command line software used to download content. At least one of each should be installed.

  1. February 11th, 2011
  2. April 15th, 2012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: