Reference

Table of Contents  ▸  List of Commands  ▸  Control Flow  ▸  if◀  for    |    local  ▶

if

Built-in command

Arguments:

Description:

Start a if...[elif]...[else]...fi block and test if specified condition holds.

condition is a mathematical expression, whose evaluation is interpreted as { 0=false | other=true }.

This command has a tutorial page.

Example of use:

$ gmic image.jpg if ia<64 add 50% elif ia<128 add 25% elif ia<192 sub 25% else sub 50% fi cut 0,255

Command: image.jpg if ia<64 add 50% elif ia<128 add 25% elif ia<192 sub 25% else sub 50% fi cut 0,255