What does the G'MIC language look like?


At it's most basic, it's actually very simple:

-input "test.bmp"
-blur 3
-normalize 0,255
-output "file.bmp"

This will input an image file, compute it's gradient norm, blur the result by variation of 3, normalize the pixel values to the range 0-255 and output to another file. You could try this out using the command line tool by putting all the statements in a single line:

gmic -input "test.bmp" -gradient_norm -blur 3 -normalize 0,255 -output "file.bmp"

But this is just scratching the surface of what can be done, obviously the more advanced the purpose of the routine you're writing the more involved it becomes. All the usual script language constructs are there (variables, conditionals, loops etc.) which make it extremely powerful. You may ask "but why does some of the code I've seen look so cryptic?". Well this is probably due to many (but not all) of the commands having a shorthand version, which is great for experienced users who want to keep things fast and short:

gmic "test.bmp" -gradient_norm -b 3 -n 0,255 -o "file.bmp"

When you combine that with some of the macros (also known as "substitution rules") the resulting script can look bewildering to a beginner, but the main purpose of G'MIC is to be a concise way of performing complex image processing routines.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks