The command line behind the Gimp plug in - GreycLab/gmic-community GitHub Wiki
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 :
- it is a way to remember settings and filter sequences,
- 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 :
gimp
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.
img src=capture_plugin.png alt=plugin 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
do
gmic $i -gimp_mix_rgb 1,0,0,1,0,0,1,0,8.5,0,2,0 -o processed_$i
done
4-Sometimes it doesn't work
Sometimes you may get an error message. For example, with:
gmic $i -gimp_yag_soften 0,0,0
you'll get:
Unknown command or filename '-gimp_yag_soften'.
This is because some of the filters available in the plug-in are defined as 'external file sources' and are not included by default in the command line tool. If you want to apply those filters from the command line, you need to include them explicitly before being able to use them.
For example, if you have an update for version 1.582, you should have a file called .update1582.gmic and you can then call it to run the command you want:
gmic $HOME/.update1582.gmic -gimp_yag_soften 0,0,0
Or, if you have a permanent internet connection, you can even use the '-update' command from 'gmic' :
gmic -update -gimp_yag_soften 0,0,0
5-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