The G'MIC-Qt GUI accepts several options on its command line, thus allowing simple batch processing. In short, command line usage is as follows:
gmic_qt [OPTIONS ...] [INPUT_FILES ...]
More than basic single input file name specification, options allow batch processing using the G'MIC filters, with or without the help of the GUI.
Instead of displaying the output image in a dialog with a "Save as..." button, the application will save the filter output in the specified file. If multiple input files are provided, it is
suggested to include one of the %b
or %f
placeholders in the specified filename so that all output images will be written to distinct files :
%b
is the input file basename, that is the filename with no extension and no path.%f
is the input file filename (without path).
If, on the other hand, multiple layers are expected as output, the %l
placeholder will be replaced by the layer number in each output file (0 is top layer).
# Launch the GUI, save output to output.png
$ ./gmic_qt --output output.png input.png
# Select a filter and its parameters twice (i.e. once for each input), save each output to a distinct file.
$ ./gmic_qt --output processed-%f input1.png input2.png
# Save the expected output layers in layer_0.png, layer_1.png, ...
$ ./gmic_qt -o /tmp/layer_%l.png -p "Layers/Tiles to Layers" gmicky.png
Set the quality of JPEG output files to N (N in 0..100).
# Select a filter through the GUI and save the result using 85 quality factor.
$ ./gmic_qt --quality 85 --output blured-gmicky.jpg gmicky.png
# Select a filter through the GUI, do not ask for JPEG quality when "Saving as..."
$ ./gmic_qt --quality 85 gmicky.png
Use last applied filter and parameters.
# Select a filter & its parameters from GUI, then apply.
$ ./gmic_qt gmicky.png
# Call the GUI with previously applied filter & parameters, output will be written to result.png
$ ./gmic_qt --repeat --output result.png hat.png
- Select filter from a full path in the filter tree or from its name (if unique).
A filter path begins with
/
, like for example/Black & White/Charcoal
.
# Launch GUI with selected filter
$ ./gmic_qt --path "/Black & White/Charcoal" gmicky.png
# Apply Charcoal filter with default parameters to image, then
# save result to charcoal-gmic.png
$ ./gmic_qt --path Charcoal --ouput charcoal-%f gmicky.png
Run the gmic command on input image(s).
If a filter name/path is provided (option -p
) and the command matches with this filter, or no filter name/path is provided and the command matches with some filter, then the parameters are completed using the filter's defaults.
If the command does not match with a filter, the option --apply
(see below) is highly recommended as the GUI will not be of any help. Of course, batch processing is possible through the extra option --output
.
# Launch GUI with filter "/Black & White/Charcoal", using 30 as its first parameter and default values otherwise.
$ ./gmic_qt -c "fx_charcoal 30" input.png
# Batch process to blur several images, showing each output with a "Save as..." option
$ ./gmic_qt -c "blur 10" images/*.png
# Batch process to blur several images, writing output images in distinct files
$ ./gmic_qt -o output/%b-blurred.jpg -c "blur 10" images/*.png
Apply filter or command without showing the main plugin dialog for filter & parameters selection. One of the following options must therefore be present: --path
, --command
or --repeat
.
# Shows up the resulting image dialog (image to be saved).
$ ./gmic_qt --apply -c "blur 10" input.png
# Just do the processing, no question asked
$ ./gmic_qt --apply --path "Black & White/Charcoal" --output output.jpg input.jpg
# Select a filter and parameters through GUI, than batch process
$ ./gmic_qt --output test.png inputs/input1.png
$ ./gmic_qt --repeat --apply --ouput output/%f input/*.png
In fact, there is a command dedicated to the latter sample use case: --first
Launch the GUI once for the first input file, then reapply selected filter and parameters to all other files like --repeat --apply
would do.
# Select a filter and parameters through GUI, than batch process to all input files
$ ./gmic_qt --reapply-first --output output/%f input/*.png
# Tune the Charcoal filter's parameters through the GUI, than batch process to all input files
$ ./gmic_qt -R -p "Charcoal" -o output/%f input/*.png
Print last applied plugin parameters
$ ./gmic_qt --apply -p "Charcoal" -c "fx_charcoal 56" input.png
$ ./gmic_qt --show-last
Path: /Black & White/Charcoal
Name: Charcoal
Command: fx_charcoal 56,70,170,0,1,0,50,70,255,255,255,0,0,0,0,0,50,50
InputMode: 1
OutputMode: 0
Print last applied plugin parameters after filter execution. (Indeed, some filters may change the value of their parameters.)
Consider multiple input files as layers of the same image (first image is the top layer).
$ ./gmic_qt -p "Blend [Average All]" --layers --apply -o output.png toplayer.png middlelayer.png bottomlayer.png