c-koi/gmic-qt

Can I submit a new filter ("Comic Book") ?

cl4cnam opened this issue · 1 comments

Do you think this filter of mine ("Comic Book") may be added to G'MIC ?

For ease of using, I give the filter again, below in the text and in a file.

#@gui ____<b>Testing</b>
#@gui <i>cli345</i>
#------------------
#@gui Comic book: comic, comic_preview(0)
#@gui : note = note("<b>Note</b>: Photo to cartoon")
#@gui : sep = separator()
#@gui : note = note(" ")
#@gui : Simplification = choice(0, "none", "light", "light antialias", "strong antialias", "median", "iuwt", "thin brush")
#@gui : sep = separator()
#@gui : note = note("<b>For edges:</b>")
#@gui : Flattening for edge (bilateral) = int(2,0,5)
#@gui : Edge method = choice(0, "Diff. of Gauss.", "Diff. of BoxBlur", "Diff. of Median")
#@gui : Edge desaturation method = choice(1, "Lightness", "MaxRGB", "MinRGB")
#@gui : Line thickness = float(1,0.5,2)
#@gui : Line strength = float(15,0,19)
#@gui : sep = separator()
#@gui : Add colors = bool(1)
#@gui : note = note("<b>For colors:</b>")
#@gui : Luminosity increase = int(10,0,50)
#@gui : Saturation increase = int(20,0,50)
#@gui : Final flattening (bilateral) = int(6,0,10)
#@gui : Lines antialias = int(15,0,100)
#@gui : Colors to black or white = bool(0)
#@gui : sep = separator()
#@gui : url = link("Filter discussed here","http://gimpchat.com/viewtopic.php?f=11&t=19335&p=266517#p266512")

comic :
	simplif=$1
	nbBilatBord=$2
	methBord=$3
	methDesat=$4
	lineThick=$5
	forceTrait=$6
	addColors=$7
	augmLum=$8
	augmSat=$9
	nbBilatFin=$10
	antialias=$11
	bw=$12
	
	if $simplif==2
		fx_smooth_antialias. 100,0,2.5,0,50,50
	elif $simplif==3
		fx_smooth_antialias. 100,0,5,0,50,50
	elif $simplif==4
		fx_smooth_median. 3,255,0,0,50,50
	elif $simplif==5
		jeje_denoise_iuwt. 3,4,2,0
		jeje_denoise_iuwt. 3,4,2,0
	elif $simplif==6
		fx_smooth_anisotropic. 60,0.9,0.64,3.1,1.1,0.8,30,2,0,1,1,0,0,24
	fi
	
	curv="0,0,"{50-$augmLum}","{50+$augmLum}",100,100,-1,0,0,"{50-$augmSat}","{50+$augmSat}",100,100,-1,0,0,100,100,-1,0,0,100,100,-1"
	+fx_curves_interactive.  7,0,1,"7",$curv
	fx_smooth_nlmeans.. 4,4,10,5,0,0,24,0
	fx_smooth_bilateral.. 10,7,$nbBilatBord,0,0
	
	+cut.. 0,255
	reverse[-2,-1]
	if $methBord==0
		blur[-3] {$lineThick}
	elif $methBord==1
		boxfilter[-3] xy,{$lineThick+0.01}
	elif $methBord==2
		median[-3] {($lineThick+0.01)*2}
	fi
	sub[-3,-2]
	
	if $methDesat==0
		fill.. "m = min(R,G,B); M = max(R,G,B); L = 0.5*(m + M); [L, L, L]"
	elif $methDesat==1
		fill.. "M = max(R,G,B); [M, M, M]"
	elif $methDesat==2
		fill.. "M = min(R,G,B); [M, M, M]"
	fi

	cut.. 0,255 n.. 0,255
	negate..
	threshold.. {$forceTrait+80}%
	n.. 0,255
	
	if $simplif>0
		fx_smooth_antialias.. 100,0,2.5,0,50,50
		fx_curves_interactive.. 7,0,1,"7","0,0,69,0,70,100,100,100,-1,0,0,100,0,-1,0,0,100,100,-1,0,0,100,100,-1"
	fi
	
	fx_smooth_antialias.. $antialias,0,1,0,50,50
	
	if $addColors==1
		mul[-2,-1]
		n. 0,255
		fx_smooth_bilateral. 10,7,$nbBilatFin,0,0
		if $bw==1
			fx_curves_interactive 7,0,1,"7","0,0,16,100,100,100,-1,0,0,100,0,-1,0,0,100,100,-1,0,0,100,100,-1"
		fi
	else
		remove[-1]
	fi

comic_preview :
	comic $*

I think I should have done a pull-request in https://github.com/dtschump/gmic-community.
So, I close it and open a pull-request.