That has fixed it indeed, thanks. The output is very “organic” looking, well done! My only (minor) complaint is processing time makes it tricky to tweak correctly, but this could just be a case of get-a-faster-computer.
Ah thanks, quite a nice word to hear! I guess that was the goal?
Yes, imagine poor me when I started this as a one liner on the command line, not knowing much about gmic functions and filters… Lots of painting in the dark.
Also, that’s the reason I added the " processing resolution" slider. I was tired of waiting. And then I added all those little bypass checkboxes, and most sliders are bypassed if you set them to zero. So if you want you can go step by step.
And now I’m searching how to make it faster, I tried “parallel” but it breaks with frame_fuzzy…
Also, how should I add presets (buttons?) and have the sliders reflect the settings? Like a few predefined params that look good and different enough. Or maybe stuff like “show only lineart” etc.?
Well, so many things to learn.
Thanks for testing, you may be the only one hahaha
Taken from the template filter file:
# A G'MIC command can set new values for each filter parameter, through the status (see command 'status').
# To do so, the returned status must follow the syntax :
# '{params1}{params2}{..}{paramsN}' where N must be exactly equal to the number of parameters
# for the current filter. Optionnally, you can append to each {param} its visibility state suffix ( e.g: {param}_1 ).
Which more or less means your command must end with the status
command (shortcut u
), with correct params. I personally find it a bit painstaking to do, mainly because the string/macro handling can be hard to grasp. My usual method is to look for an existing filter and see what it does.
I think there’s a significant number of “lurkers” who never post, don’t be so sure!
Hard to grasp indeed…
I could make presets work but couldn’t make the status command work (sliders don’t refresh) … At some point it sorta worked : i couldn’t use the checkmarks anymore, they would uncheck immediately hahaha.
I looked at other scripts (@Reptorian 's Attractor for example) that have working status refresh but couldn’t replicate it and have it work. I’ll try to create a dummy filter to test this, or just drop it.
EDIT : I got it working a few minutes later: i removed “gui_split_preview” and status update started working. Got 2 presets working but now i need to find out how to have a “no preset” dropdown entry (it doesn’t work for now). I probably have to make a preset with the default params i guess.
Hi,
I don’t know why but something weird is happening with the presets…
Example :
select filter → OK, shows default settings preview
preset 1 → OK, shows preview
preset 2 → shows preview but then switches to previous preset
preset 3 → shows preview but then switches to preset 1 ?
preset 4 → OK, shows preview
I only have a if $preset==1... elif 2... elif 3... elif 4 ... fi
structure and this doesn’t happen if i remove the “u” command to update the GUI.
It happens wether i put the status command in the preview script or the main script.
Can someone help me figure out what’s happening? Thanks.
Here is the code:
Code
#@gui WaterGmicB : watergmicB, watergmic_previewB(0)
#@gui : note = note("<small>Author: <i><a href="http://prawnsushi.free.fr">Prawnsushi</i></a>. Latest Update: <i>2023/14/03</i>.</small>")
#@gui : sep = separator()
#@gui : Write settings on picture = bool(0)
#@gui : note = note("<small>Use original input image resolution or choose processing resolution.\nHigher Res is slower and not always better. </small>")
#@gui : Original Resolution = bool(1)
#@gui : Processing Resolution = int(1000,500,5000)
#@gui : Garagecoder's DCCI2x rescale (Post) = int(0,0,5)
#@gui : sep = separator()
#@gui : note = note("<small>Will revert to None after application so settings can be modified. </small>")
#@gui : - Presets = choice(0,"None","1 - Soft","2 - Cracked","3 - Black","4 - Faded Black")
#@gui : sep = separator()
#@gui : Pre-Process = bool(1)
#@gui : - Sharpening = int(0,0,500)
#@gui : - Blur = float(0,0,10)
#@gui : - Local normalization = float(0.5,0.3,3)
#@gui : Sloppiness = bool(1)
#@gui : - Distort = float(3,0,20)
#@gui : - Blur = float(3,0,50)
#@gui : - Blend Mode = choice(13,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : - Strength = float(0.5,0.0,1.0)
#@gui : sep = separator()
#@gui : Watering = bool(1)
#@gui : - Smoothing = int(12,0,40)
#@gui : - Iterations = int(1,0,10)
#@gui : Fuzzy Frame Size = int(30,0,350)
#@gui : - Frame Blur = int(20,0,150)
#@gui : - Frame Strentgh = float(0.5,0,5)
#@gui : Plasma Seed = int(-1,-1,9999999)
#@gui : - Plasma Saturation = int(-100,-100,100)
#@gui : - Blend Mode = choice(23,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation",screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : - Plasma Strength = float(0.3,0,1)
#@gui : sep = separator()
#@gui : Cracks = bool(1)
#@gui : Sharpening = int(150,0,500)
#@gui : - Shock Filter = int(1,0,1)
#@gui : Light Relief (0 means all off) = float(0.15,0,1)
#@gui : - Light2 = float(0.02,0,1)
#@gui : - Light3 = float(0.02,0,1)
#@gui : sep = separator()
#@gui : Sketch = bool(1)
#@gui : - Likeness = int(25,0,30)
#@gui : - Threshold Min = int(0,0,255)
#@gui : - Threshold Max = int(20,0,255)
#@gui : - Sketch strength = float(1,0,1)
#@gui : --- Messy lines = float(0.9,0,1)
#@gui : - Blend Mode = choice(22,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation",screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : note = note("<small>Setting Sktech Strength to 0 disables Messy lines too.\n Messy lines uses 'Breaks' by David Tschumperlé.</small>")
#@gui : Noise = float(3,0,6)
#@gui : Canvas = float(0.3,0,1)
#@gui : sep = separator()
#@gui : Post-Process = bool(1)
#@gui : Mix Original Hue/Sat = float(0.5,0,1)
#@gui : Brightness = float(0,-100,100)
#@gui : Contrast = float(0,-100,100)
#@gui : Gamma = float(0,-100,100)
#@gui : Hue = float(0,-100,100)
#@gui : Saturation = float(0,-100,100)
#@gui : sep = separator()
watergmicB :
com,__origres,__procres,dccires,preset,__bst,__bstsharp,__bstblur,__locnorm,__filt,__dist,__distblur,__distmerge,__diststr,__wc,__bilsize,__bilrep,__fuzz,__fuzzblur,__fuzstr,__plsmseed,__plsmsat,__plasmerge,__plastr,__cracks,__sckrad,__sck,__lgtone,__lgttwo,__lgthree,__sketch,__sklike,__cutmin,__cutmax,__linestr,__brkstr,__skmerge,__noistr,cnvs,__post,__huestr,__bri,__con,__gam,__hue,__sat=$*
if $preset==1
com,__origres,__procres,dccires,preset,__bst,__bstsharp,__bstblur,__locnorm,__filt,__dist,__distblur,__distmerge,__diststr,__wc,__bilsize,__bilrep,__fuzz,__fuzzblur,__fuzstr,__plsmseed,__plsmsat,__plasmerge,__plastr,__cracks,__sckrad,__sck,__lgtone,__lgttwo,__lgthree,__sketch,__sklike,__cutmin,__cutmax,__linestr,__brkstr,__skmerge,__noistr,cnvs,__post,__huestr,__bri,__con,__gam,__hue,__sat=\
0,1,1000,0,1,1,0,0,3,1,20,10,10,0.5,1,12,2,127,42,0.365,-1,2,11,0.282,1,1,1,0.01,0.02,0.02,1,29,0,70,0.455,1,20,4,0.2,1,1,0,0,9,0,-7.2
elif $preset==2 com,__origres,__procres,dccires,preset,__bst,__bstsharp,__bstblur,__locnorm,__filt,__dist,__distblur,__distmerge,__diststr,__wc,__bilsize,__bilrep,__fuzz,__fuzzblur,__fuzstr,__plsmseed,__plsmsat,__plasmerge,__plastr,__cracks,__sckrad,__sck,__lgtone,__lgttwo,__lgthree,__sketch,__sklike,__cutmin,__cutmax,__linestr,__brkstr,__skmerge,__noistr,cnvs,__post,__huestr,__bri,__con,__gam,__hue,__sat=\
0,1,1000,0,2,0,0,0,0.3,1,3,3,13,0.5,1,12,1,0,20,0.5,-1,-100,37,0.755,1,500,1,0.027,0.02,0.02,1,25,0,220,1,0.9,22,6,0.3,1,1,0,0,31,0,0
elif $preset==3 com,__origres,__procres,dccires,preset,__bst,__bstsharp,__bstblur,__locnorm,__filt,__dist,__distblur,__distmerge,__diststr,__wc,__bilsize,__bilrep,__fuzz,__fuzzblur,__fuzstr,__plsmseed,__plsmsat,__plasmerge,__plastr,__cracks,__sckrad,__sck,__lgtone,__lgttwo,__lgthree,__sketch,__sklike,__cutmin,__cutmax,__linestr,__brkstr,__skmerge,__noistr,cnvs,__post,__huestr,__bri,__con,__gam,__hue,__sat=\
0,1,1000,0,3,1,0,0,2.3736,1,3,3,13,0.5,1,23,2,30,20,0.5,-1,-100,23,0.5,1,0,1,0.01,0.02,0.02,1,28,0,20,1,0.9,22,6,0,1,0,0,0,0,0,-100
elif $preset==4
com,__origres,__procres,dccires,preset,__bst,__bstsharp,__bstblur,__locnorm,__filt,__dist,__distblur,__distmerge,__diststr,__wc,__bilsize,__bilrep,__fuzz,__fuzzblur,__fuzstr,__plsmseed,__plsmsat,__plasmerge,__plastr,__cracks,__sckrad,__sck,__lgtone,__lgttwo,__lgthree,__sketch,__sklike,__cutmin,__cutmax,__linestr,__brkstr,__skmerge,__noistr,cnvs,__post,__huestr,__bri,__con,__gam,__hue,__sat=\
0,1,1000,0,4,1,308,0,2.3736,1,3,3,0,0.5,1,23,2,350,1,0.5,-1,100,10,1,1,0,1,0.2,0.02,0.02,1,29,0,9,0.9,1,22,6,0.12,1,0,0,0,13.4,0,-100
fi
preset=0
m "BlendMode : $""=__mode" BlendMode "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
m "BlendModeP : $""=__modep" BlendModeP "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
m "BlendModeL : $""=__model" BlendModeL "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
#~ to_rgb
normalize 0,255
nm[0] ORIG
__ORIGW={0,w}
__ORIGH={0,h}
if !$__origres
__res=$__procres,$__procres
rr2d[ORIG] $__res,0,6
fi
if $__bst
blur $__bstblur sharpen $__bstsharp normalize_local $__locnorm,$__locnorm
fi
[ORIG] nm. REND
if $__filt
[ORIG] nm. FILT
local[FILT]
apc "deform $__dist blur $__distblur"
done
blend[REND,FILT] ${__mode{$__distmerge+1}},$__diststr
n[REND] 0,255
fi
if $__wc
if $__plastr>0
[ORIG] nm. PLAS
local[PLAS]
if $__plsmseed>-1
srand $__plsmseed
fi
plasma 1,2,5
adjust_colors 0,0,0,0,$__plsmsat
done
blend[REND,PLAS] ${__modep{$__plasmerge+1}},$__plastr
fi
fi
if $__wc
if $__fuzz>0
[ORIG] nm. FUZZ
local[FUZZ]
fill_color 0,0,0
spread {$__fuzz/2},{$__fuzz/2},0
negate
frame_fuzzy $__fuzz
blur $__fuzzblur,0
deform $__fuzz
spread {$__fuzz/2},{$__fuzz/2}
spread 10
split c rm. . negate. append c
if $__fuzstr!=1
mul $__fuzstr
fi
done
blend_median[REND,FUZZ]
channels 0,2
normalize[REND] 0,255
fi
fi
local[REND]
if $__cracks
if $__sckrad>0
deform 1.5 sharpen $__sckrad,$__sck dilate_circ 1.5 sharpen $__sckrad,$__sck
fi
if $__lgtone>0
repeat 3
fx_light_relief $__lgtone,$__lgttwo,$__lgthree,0,0.2,50,50,20,0.084,0,0 blur 2 erode_circ 3 sharpen $__sckrad
done
fi
fi
if $__wc
repeat $__bilrep
deform 0.3 sharpen 80,0,10,10 bilateral $__bilsize,$__bilsize,$__bilsize,$__bilsize
done
sharpen 80,0,10,10 sharpen 50 normalize 0,255
fi
done
if $__post
if $__huestr>0
[ORIG] nm. HUE
[ORIG] nm. SAT
move[ORIG] -1
blend[HUE,REND] hue,$__huestr
blend[SAT,REND] saturation,{$__huestr/3}
fi
fi
if $__sketch
if $__linestr>0
[ORIG] nm. LINE
local[LINE]
deform 1.5 rolling_guidance {31-$__sklike},10,0.5
gradient_norm negate
if $__brkstr>0
+fx_breaks. 0,5,30,0,3
blend[-1,-2,LINE] multiply,$__brkstr
fi
normalize. $__cutmin,$__cutmax
sharpen. 100
spread. 0.7
done
blend[LINE,REND] ${__model{$__skmerge+1}},$__linestr
fi
fi
normalize[REND] 0,255
keep[REND]
if $__post
adjust_colors[REND] $__bri,$__con,$__gam,$__hue,$__sat
fi
if $dccires>0
repeat $dccires
fx_scale_dcci2x[REND] 1.15,5,1
done
fi
if $__sketch
if $__noistr>0 fx_noise $__noistr,0,11,1,0,50,50 fi
# canvas effect
if $cnvs>0
+fc 255,255,255
noise. 1000,2 to_gray.
. .
parallel " repeat 20 blur_x. 10 sharpen. 5 spread. 0.7 deform. 0.5 done ","
repeat 20 blur_y.. 10 sharpen.. 5 spread.. 0.7 deform.. 0.5 done "
*. ..
keep[0,-1]
n. 0,255
+gradient. xy,1 -a[-2,-1] c
*. {$cnvs/100}
warp[REND] [-1],3,1,1,1
fi
fi
keep[REND]
if $com
RENDW={0,w}
RENDH={0,h}
expand_y 35,0
shift 0,35
text "${1-45}",10,30,12,1,255
text ${__mode{$__distmerge+1}}" "${__modep{$__plasmerge+1}}" "${__model{$__skmerge+1}},10,50,20,1,255
fi
u "{"$com"}""{"$__origres"}""{"$__procres"}{"$dccires"}""{"0"}""{"$__bst"}""{"$__bstsharp"}""{"$__bstblur"}""{"$__locnorm"}""{"$__filt"}""{"$__dist"}""{"$__distblur"}"\
"{"$__distmerge"}""{"$__diststr"}""{"$__wc"}""{"$__bilsize"}""{"$__bilrep"}""{"$__fuzz"}""{"$__fuzzblur"}""{"$__fuzstr"}""{"$__plsmseed"}""{"$__plsmsat"}""{"$__plasmerge"}"\
"{"$__plastr"}""{"$__cracks"}""{"$__sckrad"}""{"$__sck"}""{"$__lgtone"}""{"$__lgttwo"}""{"$__lgthree"}""{"$__sketch"}""{"$__sklike"}""{"$__cutmin"}""{"$__cutmax"}""{"$__linestr"}"\
"{"$__brkstr"}""{"$__skmerge"}""{"$__noistr"}""{"$cnvs"}""{"$__post"}""{"$__huestr"}""{"$__bri"}""{"$__con"}""{"$__gam"}""{"$__hue"}""{"$__sat"}"
watergmic_previewB :
gui_split_preview "watergmicB $*"
I made some changes to code. Please compare with your earlier code, so that you can learn from it.
1. Removal of global variables. I only kept variables as global where necessary.
2. Better parameters adjustments. Setting back to 0 is not needed, when you change setting after changing preset, it'll be replaced with 0 automatically.
3. More readable code structure without changing style
Code
#@gui WaterGmicB : watergmicB, watergmic_previewB(0)
#@gui : note = note("<small>Author: <i><a href="http://prawnsushi.free.fr">Prawnsushi</i></a>. Latest Update: <i>2023/14/03</i>.</small>")
#@gui : sep = separator()
#@gui : Write settings on picture = bool(0)
#@gui : note = note("<small>Use original input image resolution or choose processing resolution.\nHigher Res is slower and not always better. </small>")
#@gui : Original Resolution = bool(1)
#@gui : Processing Resolution = int(1000,500,5000)
#@gui : Garagecoder's DCCI2x rescale (Post) = int(0,0,5)
#@gui : sep = separator()
#@gui : - Presets = choice(0,"None","1 - Soft","2 - Cracked","3 - Black","4 - Faded Black")
#@gui : sep = separator()
#@gui : Pre-Process = bool(1)
#@gui : - Sharpening = int(0,0,500)
#@gui : - Blur = float(0,0,10)
#@gui : - Local normalization = float(0.5,0.3,3)
#@gui : Sloppiness = bool(1)
#@gui : - Distort = float(3,0,20)
#@gui : - Blur = float(3,0,50)
#@gui : - Blend Mode = choice(13,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : - Strength = float(0.5,0.0,1.0)
#@gui : sep = separator()
#@gui : Watering = bool(1)
#@gui : - Smoothing = int(12,0,40)
#@gui : - Iterations = int(1,0,10)
#@gui : Fuzzy Frame Size = int(30,0,350)
#@gui : - Frame Blur = int(20,0,150)
#@gui : - Frame Strentgh = float(0.5,0,5)
#@gui : Plasma Seed = int(-1,-1,9999999)
#@gui : - Plasma Saturation = int(-100,-100,100)
#@gui : - Blend Mode = choice(23,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation",screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : - Plasma Strength = float(0.3,0,1)
#@gui : sep = separator()
#@gui : Cracks = bool(1)
#@gui : Sharpening = int(150,0,500)
#@gui : - Shock Filter = int(1,0,1)
#@gui : Light Relief (0 means all off) = float(0.15,0,1)
#@gui : - Light2 = float(0.02,0,1)
#@gui : - Light3 = float(0.02,0,1)
#@gui : sep = separator()
#@gui : Sketch = bool(1)
#@gui : - Likeness = int(25,0,30)
#@gui : - Threshold Min = int(0,0,255)
#@gui : - Threshold Max = int(20,0,255)
#@gui : - Sketch strength = float(1,0,1)
#@gui : --- Messy lines = float(0.9,0,1)
#@gui : - Blend Mode = choice(22,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation",screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : note = note("<small>Setting Sktech Strength to 0 disables Messy lines too.\n Messy lines uses 'Breaks' by David Tschumperlé.</small>")
#@gui : Noise = float(3,0,6)
#@gui : Canvas = float(0.3,0,1)
#@gui : sep = separator()
#@gui : Post-Process = bool(1)
#@gui : Mix Original Hue/Sat = float(0.5,0,1)
#@gui : Brightness = float(0,-100,100)
#@gui : Contrast = float(0,-100,100)
#@gui : Gamma = float(0,-100,100)
#@gui : Hue = float(0,-100,100)
#@gui : Saturation = float(0,-100,100)
#@gui : sep = separator()
#@gui : - Old Presets = choice(0,"None","1 - Soft","2 - Cracked","3 - Black","4 - Faded Black")_0
watergmicB :
com,origres,procres,dccires,preset,bst,bstsharp,bstblur,locnorm,filt,dist,distblur,distmerge,diststr,wc,bilsize,bilrep,fuzz,fuzzblur,fuzstr,plsmseed,plsmsat,plasmerge,plastr,cracks,sckrad,sck,lgtone,lgttwo,lgthree,sketch,sklike,cutmin,cutmax,linestr,brkstr,skmerge,noistr,cnvs,post,huestr,bri,con,gam,hue,sat=${1-46}
m "BlendMode : $""=__mode" BlendMode "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
m "BlendModeP : $""=__modep" BlendModeP "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
m "BlendModeL : $""=__model" BlendModeL "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
#~ to_rgb
normalize 0,255
nm[0] ORIG
ORIGW={0,w}
ORIGH={0,h}
if !$origres
res=$procres,$procres
rr2d[ORIG] $res,0,6
fi
if $bst
blur $bstblur sharpen $bstsharp normalize_local $locnorm,$locnorm
fi
[ORIG] nm. REND
if $filt
[ORIG] nm. FILT
local[FILT]
apc "deform "$dist" blur "$distblur""
done
blend[REND,FILT] ${__mode{$distmerge+1}},$diststr
n[REND] 0,255
fi
if $wc
if $plastr>0
[ORIG] nm. PLAS
local[PLAS]
if $plsmseed>-1
srand $plsmseed
fi
plasma 1,2,5
adjust_colors 0,0,0,0,$plsmsat
done
blend[REND,PLAS] ${__modep{$plasmerge+1}},$plastr
fi
fi
if $wc
if $fuzz>0
[ORIG] nm. FUZZ
local[FUZZ]
fill_color 0,0,0
spread {$fuzz/2},{$fuzz/2},0
negate
frame_fuzzy $fuzz
blur $fuzzblur,0
deform $fuzz
spread {$fuzz/2},{$fuzz/2}
spread 10
split c rm. . negate. append c
if $fuzstr!=1
mul $fuzstr
fi
done
blend_median[REND,FUZZ]
channels 0,2
normalize[REND] 0,255
fi
fi
local[REND]
if $cracks
if $sckrad>0
deform 1.5 sharpen $sckrad,$sck dilate_circ 1.5 sharpen $sckrad,$sck
fi
if $lgtone>0
repeat 3
fx_light_relief $lgtone,$lgttwo,$lgthree,0,0.2,50,50,20,0.084,0,0 blur 2 erode_circ 3 sharpen $sckrad
done
fi
fi
if $wc
repeat $bilrep
deform 0.3 sharpen 80,0,10,10 bilateral $bilsize,$bilsize,$bilsize,$bilsize
done
sharpen 80,0,10,10 sharpen 50 normalize 0,255
fi
done
if $post
if $huestr>0
[ORIG] nm. HUE
[ORIG] nm. SAT
move[ORIG] -1
blend[HUE,REND] hue,$huestr
blend[SAT,REND] saturation,{$huestr/3}
fi
fi
if $sketch
if $linestr>0
[ORIG] nm. LINE
local[LINE]
deform 1.5 rolling_guidance {31-$sklike},10,0.5
gradient_norm negate
if $brkstr>0
+fx_breaks. 0,5,30,0,3
blend[-1,-2,LINE] multiply,$brkstr
fi
normalize. $cutmin,$cutmax
sharpen. 100
spread. 0.7
done
blend[LINE,REND] ${__model{$skmerge+1}},$linestr
fi
fi
normalize[REND] 0,255
keep[REND]
if $post
adjust_colors[REND] $bri,$con,$gam,$hue,$sat
fi
if $dccires>0
repeat $dccires
fx_scale_dcci2x[REND] 1.15,5,1
done
fi
if $sketch
if $noistr>0 fx_noise $noistr,0,11,1,0,50,50 fi
# canvas effect
if $cnvs>0
+fc 255,255,255
noise. 1000,2 to_gray.
. .
parallel " repeat 20 blur_x. 10 sharpen. 5 spread. 0.7 deform. 0.5 done ","
repeat 20 blur_y.. 10 sharpen.. 5 spread.. 0.7 deform.. 0.5 done "
*. ..
keep[0,-1]
n. 0,255
+gradient. xy,1 -a[-2,-1] c
*. {$cnvs/100}
warp[REND] [-1],3,1,1,1
fi
fi
keep[REND]
if $com
RENDW={0,w}
RENDH={0,h}
expand_y 35,0
shift 0,35
text "${1-45}",10,30,12,1,255
text ${__mode{$distmerge+1}}" "${__modep{$plasmerge+1}}" "${__model{$skmerge+1}},10,50,20,1,255
fi
watergmic_previewB :
__output=${1-46}
preset,old_preset={[$5,$47]}
if $preset==1
variables=0,1,1000,0,1,1,0,0,3,1,20,10,10,0.5,1,12,2,127,42,0.365,-1,2,11,0.282,1,1,1,0.01,0.02,0.02,1,29,0,70,0.455,1,20,4,0.2,1,1,0,0,9,0,-7.2
elif $preset==2
variables=0,1,1000,0,2,0,0,0,0.3,1,3,3,13,0.5,1,12,1,0,20,0.5,-1,-100,37,0.755,1,500,1,0.027,0.02,0.02,1,25,0,220,1,0.9,22,6,0.3,1,1,0,0,31,0,0
elif $preset==3
variables=0,1,1000,0,3,1,0,0,2.3736,1,3,3,13,0.5,1,23,2,30,20,0.5,-1,-100,23,0.5,1,0,1,0.01,0.02,0.02,1,28,0,20,1,0.9,22,6,0,1,0,0,0,0,0,-100
elif $preset==4
variables=0,1,1000,0,4,1,308,0,2.3736,1,3,3,0,0.5,1,23,2,350,1,0.5,-1,100,10,1,1,0,1,0.2,0.02,0.02,1,29,0,9,0.9,1,22,6,0.12,1,0,0,0,13.4,0,-100
fi
if $preset
if $preset==$old_preset
if [$__output]!=[$variables]
__output=${1-4},0,${6-46}
fi
else
__output=$variables
fi
fi
com,origres,procres,dccires,preset,bst,bstsharp,bstblur,locnorm,filt,dist,distblur,distmerge,diststr,wc,bilsize,bilrep,fuzz,fuzzblur,fuzstr,plsmseed,plsmsat,plasmerge,plastr,cracks,sckrad,sck,lgtone,lgttwo,lgthree,sketch,sklike,cutmin,cutmax,linestr,brkstr,skmerge,noistr,cnvs,post,huestr,bri,con,gam,hue,sat=$__output
gui_split_preview "watergmicB $__output"
u "{"$com"}""{"$origres"}""{"$procres"}""{"$dccires"}""{"$preset"}""{"$bst"}""{"$bstsharp"}""{"$bstblur"}""{"$locnorm"}""{"$filt"}""{"$dist"}""{"$distblur"}"\
"{"$distmerge"}""{"$diststr"}""{"$wc"}""{"$bilsize"}""{"$bilrep"}""{"$fuzz"}""{"$fuzzblur"}""{"$fuzstr"}""{"$plsmseed"}""{"$plsmsat"}""{"$plasmerge"}"\
"{"$plastr"}""{"$cracks"}""{"$sckrad"}""{"$sck"}""{"$lgtone"}""{"$lgttwo"}""{"$lgthree"}""{"$sketch"}""{"$sklike"}""{"$cutmin"}""{"$cutmax"}""{"$linestr"}"\
"{"$brkstr"}""{"$skmerge"}""{"$noistr"}""{"$cnvs"}""{"$post"}""{"$huestr"}""{"$bri"}""{"$con"}""{"$gam"}""{"$hue"}""{"$sat"}""{"$preset"}"
Thanks, it’s a lot cleaner that way indeed. Hope you didn’t laugh too much though.
Didn’t think of storing the presets as strings… that was some huge waste of time. And now it seems so damn obvious!
Well, since the filter is so slow, i intended to use parallel later though, so i knew i would need the globals.
Thanks, that’s another cool part! I hope i’ll remember all that (i have a very bad memory).
I have replicated your changes in my own .gmic file(didn’t just copy/paste) but I still have some problems though: When i switch from preset to preset (1 -2 -3…) they start to be applied twice in the preview. That’s strange. I must have missed something somewhere. Maybe because i kept the vars as globals?
Thanks for the help, and your time
If you really want to find the bottleneck, I’d recommend to use text, and tic/toc command. You can retrieve time found with tic toc with ${}. There may be some faster way of doing things with convolve from the brief look.
Once again, thanks for the tips!
I’ll try to see what i can do.
One last thing, you’re missing a ""
somewhere here. So, just in case you’re missing this change.
Yeah i saw that, between procres and dccires. Which is strange anyway because i use search and replace to do this, same thing for globals ($ to $__
).
And it should be dccirep, it’s either a typo or a failure due to the flu, or fatigue. Will change that.
I tried coy/pasting your code (the whole thing) and it also does the double application on presets 2 & 3. Don’t know why it’s happening but it doesn’t when i comment out the status command. But obviously the GUI doesn’t update anymore. Actually i think the status update should be automatic, without coding it, but maybe it would cause problems in some cases.
Btw, i wanted to ask: which text editor do you (or others) use? I’m trying to find a good color scheme for G’mic scripts, i use Geany or Mousepad on Linux, and setting filetype to “shell script”. Don’t know if someone made one.
Another dumb question : is it possible to align multiple buttons or checkboxes on the same line? Could save some space.
I do think double application is a bug, but at the same time, it can be used to find bugs too because of double application. C-koi should fix this while adding a checkmark for developers.
You’ll find that there is no agreed text editor.
Reptorian use KDE Kate and almost never, Notepad++.
David use Vim or Emacs. (Not sure which).
Garagecoder use Notepad++ or Geany.
Samj use Notepad++.
You should try all of them. I’d recommend testing neovim as well.
@garagecoder , @David_Tschumperle , @samj please confirm.
I wish… There are some cool ideas I have with this in mind.
The term may be misleading. It’s not like the filter is applied twice, but like the 2nd application replaces the 1st. I use random deformations so it’s noticeable.
I know Kate but there will be so many dependencies for my Ubuntu arm xfce VM. My MacBook will fill up. Also I don’t know if there is a notepad++ for Linux. Used it around 15-20 years ago on windows though, if I’m not mistaken.
Geany is cool though, but I need better syntax highlighting. Gotta test them all now haha.
And this makes me think one could use an INT slider for presets too, if one doesn’t care about description (1,2,3,4…). Less clutter too. I also wish the separators could be clickable to fold/unflod the params in between them by default. A bit like code folding in Geany.
Thanks, found out fx_breaks and rolling_guidance ( for Sketch ) were taking a lot of time.
tests on a 3100x4400px png :
Changed fx_breaks. 0,5,30,0,3
(9s) to fx_breaks. 1,5,30,0,3
(0.5s!!!).
Changed rolling_guidance (25),10,0.5
(4,3s) to rolling_guidance (25),20,0
(2,8s)
Maybe i’ll use something else instead of rolling_guidance.
Correct, mostly Geany. Depending on the size of the gmic file I set “document type” (for highlighting) to shell, makefile, or even “R”.
Here is an update for this. The preview is a bit faster now. You can see the processing time with the checkmark. The filter takes approx 40 seconds on a 5800 x 3500px picture:
Added a few things here and there…
I still have the “double application” bug in the preview (only with presets), it’s only really annoying with the “Roll the DIce!” preset, which randomizes a lot of things, and is quite slow. Didn’t have the time to look into it, I guess i’m saving it for last!
BTW, i had to remove almost all of the
floor(u(min-max))
to convert floats to integers because it was so damn slow (Now these sliders don’t update with status, but that’s ok for now)… Is there any way to get random integers faster, using “u”?
Code 25/04/23
#@gui Uglify : uglify, uglify_preview(0)
#@gui : note = note("<small>Author: <i><a href="http://prawnsushi.free.fr">Prawnsushi</i></a>. Latest Update: <i>2023/25/04</i>.</small>")
#@gui : sep = separator()
#@gui : Write settings on picture = int(0,0,1)
#@gui : note = note{"<small>Use original input image resolution or choose processing resolution (i.e. Half res + Upscale 2x). Beware: Preview lies.</small>"}
#@gui : Original Resolution = int(1,0,1)
#@gui : Processing Resolution = int(1000,500,5000)
#@gui : Upscale 2x (Iterations) = _int(0,0,5)
#@gui : sep = separator()
#@gui : - Presets = choice(0,"Default","1 - From Scratch","2 - Soft","3- Cracked","4 - Black","5 - Faded Black")
#@gui : sep = separator()
#@gui : Pre-Process = int(1,0,1)
#@gui : - Sharpening = int(0,0,500)
#@gui : - Blur = float(0,0,10)
#@gui : - Local normalization = float(0,0,3)
#@gui : sep = separator()
#@gui : Sloppiness = int(1,0,1)
#@gui : - Distort = float(3,0,20)
#@gui : - Blur = float(3,0,50)
#@gui : - Blend Mode = choice(13,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : - Strength = float(0.5,0.0,1.0)
#@gui : sep = separator()
#@gui : Watering = int(1,0,1)
#@gui : - Smoothing = int(12,0,40)
#@gui : - Iterations = int(1,0,10)
#@gui : Fuzzy Frame Size = int(30,0,350)
#@gui : - Frame Blur = int(20,0,150)
#@gui : - Frame Strentgh = float(0.5,0,5)
#@gui : Plasma Seed ( -1 : Random ) = int{-1,-1,999999}
#@gui : - Plasma Saturation = int(-100,-100,100)
#@gui : - Plasma Blur = float(0,0,50)
#@gui : - Blend Mode = choice(7,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation",screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : - Plasma Strength = float(0.6,0,1)
#@gui : sep = separator()
#@gui : Cracks = int(1,0,1)
#@gui : Sharpening = int(150,0,500)
#@gui : - Shock Filter = int(1,0,1)
#@gui : Light Relief (0 means all off) = float(0.15,0,1)
#@gui : - Light2 = float(0.02,0,1)
#@gui : - Light3 = float(0.02,0,1)
#@gui : sep = separator()
#@gui : Sketch = int(1,0,1)
#@gui : - Likeness = int(25,0,30)
#@gui : - Threshold Min = int(0,0,255)
#@gui : - Threshold Max = int(255,0,255)
#@gui : - Thickness = int(2,0,40)
#@gui : - Sketch strength = float(1,0,1)
#@gui : --- Messy lines = float(0.9,0,1)
#@gui : - Blend Mode = choice(22,"add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation",screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor")
#@gui : note = note("<small>Setting Sktech Strength to 0 disables Messy lines too.\n Messy lines uses 'Breaks' by David Tschumperlé.</small>")
#@gui : sep = separator()
#@gui : Noise = float(3,0,6)
#@gui : Canvas = float(0.3,0,1)
#@gui : Canvas style = int(0,0,100)
#@gui : Color = color(255,255,255,0)
#@gui : sep = separator()
#@gui : Post-Process = int(1,0,1)
#@gui : Emboss = float(1.5,0,5)
#@gui : Mix Original Hue/Sat = float(0.5,0,1)
#@gui : Brightness = float(0,-100,100)
#@gui : Contrast = float(0,-100,100)
#@gui : Gamma = float(0,-100,100)
#@gui : Hue = float(0,-100,100)
#@gui : Saturation = float(0,-100,100)
#@gui : sep = separator()
#@gui : - Old Presets = _choice(0,"Default","1 - From Scratch","2 -Soft","3 - Cracked","4 - Black","5 - Faded Black")_0
uglify :
com,origres,procres,dccires,preset,bst,bstsharp,bstblur,locnorm,\
filt,dist,distblur,distmerge,diststr,wc,bilsize,bilrep,fuzz,fuzzblur,\
fuzstr,plsmseed,plsmsat,plsmblur,plasmerge,plastr,cracks,sckrad,sck,lgtone,\
lgttwo,lgthree,sketch,sklike,cutmin,cutmax,linthick,linestr,brkstr,skmerge,\
noistr,cnvs,cvmod,cvr,cvg,cvb,cva,post,emboss,huestr,\
bri,con,gam,hue,sat=${1-54}
m "BlendMode : $""=__mode" BlendMode "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
m "BlendModeP : $""=__modep" BlendModeP "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
m "BlendModeL : $""=__model" BlendModeL "add","and","average","blue","burn","darken","difference","divide","dodge","exclusion","grainextract","grainmerge","green","hardlight","hardmix","hue","interpolation","lighten","lightness","linearburn","linearlight","luminance","multiply","negation","or","overlay","pinlight","red","reflect","saturation","screen","shapeaverage","softburn","softdodge","softlight","stamp","subtract","value","vividlight","xor","error"
to_rgba
nm[0] ORIG
ORIGW={0,w}
ORIGH={0,h}
if !$origres
res=$procres,$procres
rr2d[ORIG] $res,0,6
fi
n 0,255
if $bst
if $bstblur blur $bstblur fi
if $bstsharp sharpen $bstsharp fi
if $locnorm normalize_local $locnorm,$locnorm fi
fi
[ORIG] nm. REND
if $filt
if $diststr
[ORIG] nm. FILT
local[REND,FILT]
usrmod=$dist,$distblur
if [$usrmod]!=[0,0]
if $dist apc. "deform $dist" fi
if $distblur blur. $distblur fi
blend[REND,FILT] ${__mode{$distmerge+1}},$diststr
n[REND] 0,255
fi
done
fi
fi
if $wc
if $plastr
[ORIG] nm. PLAS
local[PLAS]
if $plsmseed>-1 srand $plsmseed fi
plasma 1,2,5
if $plsmsat!=0 adjust_colors 0,0,0,0,$plsmsat fi
if $plsmblur>0 blur $plsmblur fi
done
blend[REND,PLAS] ${__modep{$plasmerge+1}},$plastr
fi
#~ fi
#~ if $wc
if $fuzz
[ORIG] nm. FUZZ
local[FUZZ]
fc 0,0,0
negate
frame_fuzzy $fuzz
if $fuzzblur blur $fuzzblur,0 fi
deform $fuzz
spread {$fuzz/2},{$fuzz/2}
split c rm. . negate. a c
if $fuzstr!=1
mul $fuzstr
fi
done
blend_median[REND,FUZZ]
fi
fi
local[REND]
if $cracks
if $sckrad
deform 1.5 sharpen $sckrad,$sck dilate_circ 1.5 sharpen $sckrad,$sck
fi
if $lgtone
repeat 3
fx_light_relief $lgtone,$lgttwo,$lgthree,0,0.2,50,50,20,0.084,0,0
blur 2 erode_circ 3 sharpen $sckrad
done
fi
fi
if $wc
if $bilrep>0
repeat $bilrep
deform {0,w/1000}
bilateral $bilsize,$bilsize,$bilsize,$bilsize
done
fi
fi
done
if $post
if $huestr
[ORIG] nm. HUE
[ORIG] nm. SAT
b[HUE,SAT] 5
blend[HUE,REND] hue,$huestr
blend[SAT,REND] saturation,{$huestr}
fi
fi
if $sketch
if $linestr>0
[ORIG] nm. LINE
local[LINE]
r 50%,50%,1,6
deform {0,w/2000}
rolling_guidance {31-$sklike},20,0
r 200%,200%,1,6
gradient_norm negate
if $brkstr>0
+fx_breaks. 1,5,20,0,3
blend[-1,-2,LINE] multiply,$brkstr
fi
if $linthick erode_circ. $linthick spread {$linthick/10} dilate_circ. 3 fi
n. $cutmin,$cutmax
sharpen. 100
spread. 1.7
done
split[REND] c
a[1,2,3] c
blend[LINE,REND] ${__model{$skmerge+1}},$linestr
a[REND] [-1],c
fi
fi
normalize[REND] 0,255
keep[REND]
if $post
usrmod=$bri,$con,$gam,$hue,$sat
if [$usrmod]!=[0,0,0,0,0]
adjust_colors[REND] $bri,$con,$gam,$hue,$sat
fi
fi
if $dccires
repeat $dccires
r 200%,200%
done
fi
if $noistr
fx_noise $noistr,0,11,1,0,50,50
fi
if $cnvs
+fc 255,255,255
noise. 50,2
to_gray.
. .
if $cvmod
__wat=$cvmod,1,45
else
__wat=0,0,0
fi
parallel " blur_x. 30 water. $__wat sharpen. 50 spread. 1.7 "," blur_y.. 30 water.. $__wat sharpen.. 50 spread.. 1.7 "
*. ..
keep[0,-1] n. 0,255
+gradient. xy,1 -a[-2,-1] c
*. {$cnvs/100}
warp[REND] .,3,1,1,1
fi
+fc[REND] $cvr,$cvg,$cvb,$cva
move[-1] 0
blend[0,REND] alpha
nm[0] REND
keep[REND]
if $post
if $emboss
fx_emboss_relief 5,0,0.5,$emboss,1,0,1
fi
fi
if $com
expand_y 35,0
shift 0,35
text "${1--1}",10,30,12,1,255
text ${__mode{$distmerge+1}}" "${__modep{$plasmerge+1}}" "${__model{$skmerge+1}},10,50,20,1,255
fi
uglify_preview :
__output=${1--2}
preset,old_preset={[$5,${-1}]}
if $preset==1
variables=0,1,1000,0,1,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,-1,-100,0,23,0,0,0,0,0,0,0,0,0,0,255,2,0,0,22,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0
elif $preset==2
variables=0,1,1000,0,2,1,0,2,0,1,20,10,7,0.4,1,12,2,127,42,0.365,-1,0,0,11,0.5,1,1,0,0.01,0.02,0.02,1,30,0,255,5,1,0,22,6,0,0,255,255,255,255,1,0,0.8,0,0,9,0,0
elif $preset==3
variables=0,1,1000,0,3,0,0,0,0.3,1,3,3,13,0.5,1,12,1,0,20,0.5,-1,-100,0,37,0.755,1,500,1,0.027,0.02,0.02,1,25,0,255,2,1,0.9,22,6,0.3,0,255,255,255,255,1,1.5,1,0,0,31,0,0
elif $preset==4
variables=0,1,1000,0,0,1,0,0,2.3736,1,3,3,13,0.5,1,23,2,30,20,0.5,-1,80,0,7,0.2,1,0,1,0.01,0.02,0.02,1,28,0,255,2,1,0.9,22,6,1,11,255,255,255,255,1,1.1,0,0,0,-30,0,-100
elif $preset==5
variables=0,1,1000,0,0,1,308,0,2.3736,1,3,3,0,0.5,1,23,2,350,1,0.5,-1,100,0,10,1,1,0,1,0.2,0.02,0.02,1,29,0,255,2,0.9,1,22,6,1,19,134,110,71,255,1,1,0,0,0,13.4,0,-100
fi
if $preset
if $preset==$old_preset
if [$__output]!=[$variables]
__output=${1-4},0,${6--2}
fi
else
__output=$variables
fi
fi
com,origres,procres,dccires,preset,bst,bstsharp,bstblur,locnorm,\
filt,dist,distblur,distmerge,diststr,wc,bilsize,bilrep,fuzz,fuzzblur,\
fuzstr,plsmseed,plsmsat,plsmblur,plasmerge,plastr,cracks,sckrad,sck,lgtone,\
lgttwo,lgthree,sketch,sklike,cutmin,cutmax,linthick,linestr,brkstr,skmerge,\
noistr,cnvs,cvmod,cvr,cvg,cvb,cva,post,emboss,huestr,\
bri,con,gam,hue,sat=$__output
uglify $__output
u "{"$com"}""{"$origres"}""{"$procres"}""{"$dccires"}""{"$preset"}""{"$bst"}""{"$bstsharp"}""{"$bstblur"}""{"$locnorm"}"\
"{"$filt"}""{"$dist"}""{"$distblur"}""{"$distmerge"}""{"$diststr"}""{"$wc"}""{"$bilsize"}""{"$bilrep"}""{"$fuzz"}""{"$fuzzblur"}"\
"{"$fuzstr"}""{"$plsmseed"}""{"$plsmsat"}""{"$plsmblur"}""{"$plasmerge"}""{"$plastr"}""{"$cracks"}""{"$sckrad"}""{"$sck"}""{"$lgtone"}"\
"{"$lgttwo"}""{"$lgthree"}""{"$sketch"}""{"$sklike"}""{"$cutmin"}""{"$cutmax"}""{"$linthick"}""{"$linestr"}""{"$brkstr"}""{"$skmerge"}"\
"{"$noistr"}""{"$cnvs"}""{"$cvmod"}""{"$cvr,$cvg,$cvb,$cva"}""{"$post"}""{"$emboss"}""{"$huestr"}"\
"{"$bri"}""{"$con"}""{"$gam"}""{"$hue"}""{"$sat"}""{"$preset"}"
That is quite surprising.
This shouldn’t take a lot of time.
For me (ubuntu), I have for instance:
foo :
sp lena,1024
tic
+f ">floor(i/10)"
toc
rm.
tic
+f ">round(i/10)"
toc
rm.
→
$ gmic foo
[gmic]-0./ Start G'MIC interpreter.
[gmic]-2./foo/ Elapsed time: 0.083 s.
[gmic]-2./foo/ Elapsed time: 0.09 s.
So computing the floor value for 1024x1024=1048576 values takes 83 ms.
Well, i have around 40-45 random values (u). Don’t know if that counts?
Probably half are integers so i have to use floor. But then this preset was very slow to render. I’m not sure what causes this so i removed the floor command and it seems a bit faster. And this double application drives me crazy, sometimes .
Here are my results:
$ gmic sp lena,1024 tic +f ">floor(i/10)" toc rm. tic +f ">round(i/10)" toc rm.
[gmic]-0./ Start G'MIC interpreter.
[gmic]-1./ Input sample image 'lena' (1 image 1024x1024x1x3).
[gmic]-1./ Initialize timer.
[gmic]-1./ Fill image [0] with expression '>floor(i/10)'.
[gmic]-2./ Elapsed time: 0.041 s.
[gmic]-2./ Remove image [1] (1 image left).
[gmic]-1./ Initialize timer.
[gmic]-1./ Fill image [0] with expression '>round(i/10)'.
[gmic]-2./ Elapsed time: 0.051 s.
[gmic]-2./ Remove image [1] (1 image left).
[gmic]-1./ Display image [0] = 'lena'.
Maybe it’s not what causes the slowdown then.
I guess my script doesn’t like random floats like " 0.138653263528759" ?
Runs to https://gmic.eu/reference/mathematical_expressions.html
Updated script here : Trying to make my 1st "pipeline filter" - #32 by prawnsushi
Here are a few possibilities for this Frankenscript
Original picture from Unsplash : Adnan Mistry