GMIC

From OHRRPGCE-Wiki
Jump to navigation Jump to search

GMIC is a framework for building image filters. There is a commandline version, and a GIMP plugin version. It includes many (300+) filters, and you can define more as needed. In general, the results are higher quality than comparable alternate implementations of the same filter (ie. if you want to use Unsharp Mask, the GMIC Unsharp Mask implementation is likely to produce highest quality results compared to anything else.)

Custom filters can be stored in the file ~/.gmic and it's possible to mark your favorite filters so you can apply them faster (in recent versions of GMIC)

If you want to try the following one, that's what to do: paste the following into ~/.gmic



#@gimp Antialias: antialias, antialias_preview
#@gimp : Smoothing = float(2,0.5,1024)
#@gimp : Sharpness = float(0,0.001,1)
#@gimp : Detail preservation = float(.20,-.999999,2)
#@gimp : Iterations = int(1,1,32)
#@gimp : Gradient Smoothing* = float(0,0,10)
#@gimp : Tensor Smoothing* = float(0.5,0,10)
#@gimp : Angular precision* = float(15,1.0,180.0)
#@gimp : Fast Approximation* = bool(1)
#@gimp : DoG base* = float(0.05,0.001,100)
#@gimp : DoG distance* = float(0.05,0.001,100)
#@gimp : DoG threshold* = float(20,0.0001,49.999)
#@gimp : Value precision* = float(2,0.10,5.0)
#@gimp : Gamma-correct* = bool(1)
#
antialias :
  -e "Antialias image$?"
  -v -
  -repeat @# -l[@{>}]
    -if {$13==1}
      -apply_gamma[-1] {1/2.2}
    -endif
    --gimp_dog[-1] $9,{$9+$10},$11,1,0
    -input [-2]x1
    -repeat $4 -smooth[-1] $1,$2,1.0,$5,$6,.8,$7,$12,0,$8 -done
    -if {$3>0}
      -normalize[-2] 0,1
      -if {$3>1}
        -apply_curve[-2] 1,.5,{.5-{{127/256}*{$3-1}}}
      -else
        -apply_curve[-2] 1,{93/255},{.73-.73*$3},{192/255},{192/255}
      -endif
      -image[-3] [-1],0,0,0,0,1,[-2]
    -else
      -image[-3] [-1],0,0,0,0,{1+$2}
    -endif
    #,[-2]
    -remove[-2,-1]
    -if {$13==1}
      -apply_gamma[-1] {2.2/1}
    -endif
    -endlocal
  -done
  -v +
antialias_preview :
  -e "Antialias image$? preview"
  -v -
    -l[0]
    -if {$13==1}
      -apply_gamma[-1] {1/2.2}
    -endif
    --gimp_dog[-1] $9,{$9+$10},$11,1,0
    -input [-2]x1
    -repeat $4 -smooth[-1] $1,$2,1.0,$5,$6,.8,$7,$12,0,$8 -done
    -if {$3>0}
      -normalize[-2] 0,1
      -if {$3>1}
        -apply_curve[-2] 1,.5,{.5-{{127/256}*{$3-1}}}
      -else
        -apply_curve[-2] 1,{93/255},{.73-.73*$3},{192/255},{192/255}
      -endif
      -image[-3] [-1],0,0,0,0,1,[-2]
    -else
      -image[-3] [-1],0,0,0,0,{1+$3}
    -endif
    #,[-2]
    -remove[-2,-1]
    -if {$13==1}
      -apply_gamma[-1] {2.2/1}
    -endif
  -endlocal
  -v +