Well, as you all know I’m not making new filters for production, mainly because I decide to focus on re-factorization and improvement to my G’MIC scripts. There are still two roadblocks that I have to go through before that can even happen. And they’re not even small roadblocks, they’re huge.
So, I decide to make a new thread, specifically not to announce new filters, but small quality of life improvement. And some missed things too.
Here will there be some ideas that I have in mind for improvement of my old filters, and possibly be useful for others.
Some few recent commands I have pushed into gmic-community:
rep_pf_args # Return argument with prefix/postfix added
rep_substr_ret_args # Return arguments that contains substring
rep_concat_imgs_vals_uniq # Output concatenated image values. Actually, I don't know why would you use it, but it's something I thought about.
rep_uniq_args # Return unique arguments
rep_sug_args # Return arguments that are close
These don’t do much for image processing. However, those are pretty good for making error messages, which is why I have made them. So, hence, they do provide a small quality of life improvement though 3rd one is questionable, but I can use that as a workaround if G’MIC ever receive direct unicode support and being able to get around 0-255 annoyance.
Some missed bit:
#@cli rep_digamma:
#@cli : Return the Logarithmic deritative of the Gamma function
#@cli : Original code has been made by Mark Johnson. Permission has been granted to use his code. Link to source - http://web.science.mq.edu.au/~mjohnson/code/digamma.c
rep_digamma:
eval "
digamma(n)=(
result=0;
p=n;
while(p<7,
result-=1/p;
++p;
);
x0=p-(1/2);
xx=1/x0;
xx2=sqr(xx);
xx4=sqr(xx2);
result+=log(x0)+(1./24)*xx2-(7/960)*xx4+(31/8064)*xx4*xx2-(127/30720)*xx4*xx4;
);
digamma($1);"
This one I made it to calculate digamma, but I think I would rather have this seen in the math parser language.
Finally, I made this recently as there is a code that I have which has the following string: “1,1,1,2,2,2,3,3,3,4,4,4,5,5,5”. That can be shortened to ${rep_ls\ 1,5,5,3}.
#@cli rep_ls: start_num,end_num,size_of_array,repeat
#@cli : Return linear space sequence.
rep_ls:
check isfinite($1)&&isfinite($2)&&isint($3,1)&&isint(${4=1},1)
if $3==1 u $1 return fi
u {expr('$1+y*{($2-$1)/($3-1)}',$4,$3)}
Result of this:
C:\Windows\System32>gmic e ${rep_ls\ 2,10,5}
[gmic]./ Start G'MIC interpreter (v.3.7.3).
2,4,6,8,10
[gmic]./ End G'MIC interpreter.
C:\Windows\System32>gmic e ${rep_ls\ 1,5,5,3}
[gmic]./ Start G'MIC interpreter (v.3.7.3).
1,1,1,2,2,2,3,3,3,4,4,4,5,5,5
[gmic]./ End G'MIC interpreter