Jump to content

Reptorian's G'MIC Code Workshop


Recommended Posts

Some of you may notice that some of my filters has broke. That's because @G'MIC has updated gmic internals to have functions like fill(), and repeat(), and I had made a commit to replace for loop with repeat().


It's done because they are to be optimized. So, one should wait until next g'mic update to use them.

Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

Decided not gonna release that filter because there is a problem with current implementation of quadrilateral distort. Particularly when the quad is so distorted that nan values start showing up.


So, I went to work into a random bars filter. One that will eventually be more flexible than @pyrochild gradient bars. None of his/her code has been used, it's entirely a new code.





skip ${11=}
#$8=Gradient Shift#
#$9,$10=Gradient Min/Max Multiplier#


f "begin(
  const ww=w-1;
  const hh=h-1;
  const sd=max(ww,hh)/min(ww,hh);
  const sx=ww>hh?sd:1;
  const sy=ww>hh?1:sd;
  const wwsx=ww*sx;
  const hhsy=hh*sy;
  const pyth_img=sqrt(ww^2+hh^2);
  const ww_div_sx=ww/sx;
  const hh_div_sy=hh/sy;
  const cx=ww/2;
  const cy=hh/2;
  const ox=cx-(cx*$6);
  const oy=cy+(cy*$7);
  const skew_ang=($5/180)*pi;
  const mdist=tan(skew_ang)*pyth_img;
  const ang=($4/180)*pi;
  const cos_ang=cos(ang);
  const sin_ang=sin(ang);
  const cut_ang=atan2(cy,cy);
  const cut_ang2=pi-cut_ang;
  const total_width=$1+$2;
  const spacing=($2/(total_width-1))/2;
  const trimmed_ang=fmod(ang,pi);
  const nbars=((trimmed_ang>=cut_ang)&&(trimmed_ang<cut_ang2))?ceil((abs(1/sin(ang))*ww)/total_width):ceil((abs(1/cos(ang))*hh)/total_width);
  const shift_bars=int(nbars/2);
  fill(v_use_invert,round(u(0,1))==1?1:-1 );
   const outmode=$11%3;


As you can see the code is different.


Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

@Ego Eram Reputo @lynxster4 Thank you for the feedback.


So far, the gradient bars is nearly done. For proof (I got duotone color to work):






1. Add Duotone option for spaces.

2. Add animation support.


For such a simple idea, that's a lot of work. Maybe for just spaces filling, I could just make a separate command for that, and then combine both as a gui filter.


Side note:


Lyupanov Fractal is under work



Edited by Reptillian
  • Like 2

G'MIC Filter Developer

Link to comment
Share on other sites

You are busy, busy, busy @Reptillian!  Keep up the good work...we all appreciate very much!  👍 😊


Link to comment
Share on other sites

  • 2 weeks later...

Other than the Lyapunov, I had fixed the Random Gradient Bars, it is now more controllable there. But, this isn't noteworthy here because I had created the CodeLab version of the filter.


So, I will show that I made another coloring mode to Lyapunov Fractal.





Here's what is missing with the Lyapunov Fracta.


1) Custom coloring support. That means 2 more modes are TODO. One mode for defining colorings of negative/positive, and the other is a map toward the ranges of the Lyapunov Fractal.

2) Grayscale Mode. This means that it'll be the default output or negative output.

Edited by Reptillian
  • Like 1
  • Upvote 1

G'MIC Filter Developer

Link to comment
Share on other sites

New Filter! - Weighted RGB To Grayscale






Based on MJW Black and White + PDN plugin, I have decided to make my own twist based on some of the principles found in that plugin. This is my own take on the ideas founded on that plugin.


The main difference is that it doesn't support color interpolation, and it doesn't need to in context of some image editors as they do support high depth, and the way Min-Max Interpolation behave.


@MJW - Do you want me to add credits within the GUI since I had only made the code just on principles?

  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

  • 3 weeks later...

Now, I had pushed a new version of Diffusion Limited Aggregation.


Changes according to commit log:



Upgrade to Diffusion Limited Aggregation



1. The use of meta-coding to generate proper multi-threaded code on the fly. Much of the behavior of the very old single-threaded rep_dla has been retained, and much better retained in this version.

2. It is now fast enough that preview makes perfect sense.

3. Filter can be applied to multiple images.


Edited by Reptillian
  • Like 1

G'MIC Filter Developer

Link to comment
Share on other sites

  • 3 weeks later...

That is so cool @Reptillian!  It looks like a skeletonized alien head. I love it!  🥰

I take it, this is for GMIC?

  • Like 1
Link to comment
Share on other sites

6 hours ago, lynxster4 said:

That is so cool @Reptillian!  It looks like a skeletonized alien head. I love it!  🥰


Agreed. It's very H R Geiger :devlish:

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...