How to make a stand-alone command-line for the filter Smooth Skin?

Hello there,

I’m trying to find the G’MIC command-line syntax for the “Repair --> Smooth [Skin]” filter, but I can’t find it. Can anybody help me?

This is a command for the Repair --> Smooth [Anisotropic]:
gmic .png smooth 40,0,1,1,2 output .png

But I’m looking for someting like this:
gmic .png smooth-skin 0.5,1,1,50,50,5,2,0.2,3 output .png

See the attached screenshot for possible Smooth [Skin] options, I’m using G’MIC-Qt v2.9.1.

Regards, Marcel.

Screenshot from 2020-09-02 15-00-28

To get the command line for any G’MIC-Qt filter, you can go to Settings and select this option:

i.e Output messages-> Verbose (layer name).

Then apply the filter with the desired parameters. The corresponding G’MIC command line will be displayed as the name of the processed layer.

For the Smooth Skin filter, you’ll get something as:

[G'MIC] Smooth [Skin]: fx_smooth_skin 2,0.5,1,1,1,50,50,5,2,0.2,3,1,0.05,5,0,50,50

meaning, the equivalent command line is:

$ gmic input.png fx_smooth_skin 2,0.5,1,1,1,50,50,5,2,0.2,3,1,0.05,5,0,50,50 -o output.png
3 Likes

Hello David,

Your answer worked right-away for me! Thanks a lot.
Is there a CLI-manual to find out that this filter is called “fx_smooth_skin” ?
And an explaination of that row of comma-seperated option numbers?

But for now… I’m a happy camper! :smiley:

Regards, Marcel

No manual entry since it doesn’t have CLI comments. The code is available here: https://raw.githubusercontent.com/dtschump/gmic/master/src/gmic_stdlib.gmic. Hint: $1, $2, etc., are the parameters in order.

#@gui Smooth [Skin] : fx_smooth_skin, fx_smooth_skin_preview(1)
#@gui : note = note("<small><b>Step 1:</b> Skin detection</small>")
#@gui : Skin Estimation = choice(2,"None","Manual","Automatic")
#@gui : Tolerance = float(0.5,0,1)
#@gui : Smoothness = float(1,0,5)
#@gui : Threshold = float(1,0,10)
#@gui : Pre-Normalize Image = bool(1)
#@gui : X-Coordinate [Manual] = float(50,0,100)
#@gui : Y-Coordinate [Manual] = float(50,0,100)
#@gui : Radius [Manual] = float(5,0,25)
#@gui : sep = separator()
#@gui : note = note("<small><b>Step 2:</b> Medium scale smoothing</small>")
#@gui : Base Scale = float(2,0,10)
#@gui : Fine Scale = float(0.2,0,0.8)
#@gui : Smoothness = float(3,0,10)
#@gui : Smoothness Type = choice(1,"Gaussian","Bilateral")
#@gui : sep = separator()
#@gui : note = note("<small><b>Step 3:</b> Details enhancement</small>")
#@gui : Gain = float(0.05,0,0.5)
#@gui : sep = separator()
#@gui : Preview Data = choice{5,"Skin Mask","Base Scale","Medium Scale (Original)","Medium Scale (Smoothed)",
#@gui : "Fine Scale","Result Image"}
#@gui : sep = separator()
#@gui : Preview Type = choice("Full","Forward Horizontal","Forward Vertical","Backward Horizontal",
#@gui : "Backward Vertical","Duplicate Top","Duplicate Left","Duplicate Bottom","Duplicate Right",
#@gui : "Duplicate Horizontal","Duplicate Vertical","Checkered","Checkered Inverse")
#@gui : Preview Split = point(50,50,0,0,200,200,200,0,10)_0
#@gui : sep = separator()
#@gui : url = link("Click here for a video tutorial","http://www.youtube.com/watch?v=H8pQfq-ybCc")
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>David Tschumperlé</i>.      Latest Update: <i>2013/20/12</i>.</small>")
fx_smooth_skin :
  repeat $! l[$>] split_opacity l[0] to_rgb

    # Skin detection step.
    if $5 +balance_gamma 128,128,128 else [0] fi
    if $1==0 channels. 0 f. 1 elif $1==2 detect_skin. $2 else detect_skin. $2,$6%,$7%,$8% fi
    M={iM} b. $3% *. {$M/iM} *. $4 c. 0,1

    # Details smoothing step.
    split_details[0] 4,$9%,$10%
    +_fx_smooth_skin[2] $12,$11
    j[2] .,0,0,0,0,1,.. rm[-2,-1]
    *. {10^$13} + c 0,255

  endl a c endl done

_fx_smooth_skin :
  if $1==0 b {$2/8}%
  else
    if $2>0
      m={im} M={iM} n 0,255
      repeat int($2/5) bilateral 3%,{5*3} done
      bilateral 3%,{($2%5)*3}
      * {($M-$m)/255} + $m
    fi
  fi

fx_smooth_skin_preview :
  if $-2==0
    gui_split_preview "if $5 balance_gamma 128,128,128 fi if $1==0 f 1 elif $1==2 detect_skin $2 "\
     "else detect_skin $2,$6%,$7%,$8% fi M={iM} b $3% * {255*$M/iM} * $4 c 0,255",${-3--1}
  elif $-2==1
    gui_split_preview "b $9%",${-3--1}
  elif $-2==2
    gui_split_preview "split_details 4,$9%,$10% k.. n 0,255",${-3--1}
  elif $-2==3
    gui_split_preview "split_details 4,$9%,$10% k.. _fx_smooth_skin $12,$11 n 0,255",${-3--1}
  elif $-2==4
    gui_split_preview "split_details 4,$9%,$10% k. n 0,255",${-3--1}
  else
    gui_split_preview "fx_smooth_skin $*",${-3--1}
  fi

  if $1==1
    to_rgb
    circle $6%,$7%,$8%,0.2,0,255,0
    circle $6%,$7%,$8%,0.4,0xFFFFFFFF,0,255,0
    line {$6-0.25*$8}%,{$7-0.25*$8}%,{$6+0.25*$8}%,{$7+0.25*$8}%,0.8,255,255,0
    line {$6+0.25*$8}%,{$7-0.25*$8}%,{$6-0.25*$8}%,{$7+0.25*$8}%,0.8,255,255,0
  fi