Reptillian

Reptorian's G'MIC Code Workshop

Recommended Posts

Added projects to my own g'mic community fork. Also, my g'mic community fork has been updated.

 

https://github.com/Reptorian1125/gmic-community/projects

 

These are the list of projects to do.

Recreate all of MadJik plugins with extension - Permission has been given by MadJik to reverse-engineer those plugins. Ask MadJik if you want confirmation.

Create g'mic gossamer - Create my own version of gossamer. No reverse engineering has been done.

Update modular_formula - N/A

Update Pseudo-ECB script - See Joan Rake's G'MIC Pseudo-ECB. I am upgrading that.

 

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

Minor update, 2 of my projects has been closed. I completed modf, and I have managed to make rep_tfrac more maintainable. modf calculates the result the fastest way I can get it to.

 

For Projects reference:

 

1.Add support for custom palette for Autofill Coloring Book
2.Upgrade Construction Material Texture
3.Recreate all of MadJik plugins with extension - Permission has been given by MadJik to reverse-engineer those plugins. Ask MadJik if you want confirmation.
4.Create g'mic gossamer
5.Create my own version of gossamer. No reverse engineering has been done. - See Joan Rake's G'MIC Pseudo-ECB. I am upgrading that.

 

Note - modf is basically the g'mic version of Image Modulo Toolkit I have made for Paint.NET.

 

Pull Request Link -

https://github.com/dtschump/gmic-community/pull/239

Edited by Reptillian

Share this post


Link to post
Share on other sites

Here's some new changes.

 

Some of my filters have been moved to Distortions and Rendering. Nebulous is under Rendering now. The only fixes that would be needed to them are cosmetic fixes basically as in better description/grammar and forgotten credits (distortions part needs attribution which I will do even if I mentioned who did the original version @Asmageddon Prince before). They don't have bugs otherwise.

 

Thorn Fractal has been upgraded. Now, you can insert custom alternating formula. 

 

EDIT: Definitely here. Refresh filters.

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

I have made a new filter named Majority. Yes, it operates on the very same principles as the one MadJik has made, but extended. It has arrived by the way.

Edited by Reptillian

Share this post


Link to post
Share on other sites

It been a while since I have been into this thread, but now I got something thanks to @Creed31 that indirectly gave me the idea.

 

New Filter - Rectangle-Square Fill

 

I will be finishing up the image mapping version of tomorrow or two, and immediately push it by then.

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

Taken a break from that for a while. So, here's what I did: I have pushed rep_primelist cli and rep_prime_surface (The algorithm is slow, but miles faster than the earlier one), better version of Grouped Pixels Shift filter, some undeveloped cli only pushed there for development purpose and backup. The rectangular fill surface isn't really finished yet, but there is some new clis related to it, so that I can get to working when I'm really back with g'mic development.

 

Also, the algorithm for the Grouped Pixels Shift filter is literally fast, and I believe it can be introduced very easily in context of PDN and C#. So, I will share the code here with a explanation.

 

Is multiple surfaces possible in Paint.NET plugin? @Ego Eram Reputo This code uses 4 different surfaces. If not, I'll delete this since it can't be translated.

#@cli rep_sptbwgp: (eq. to rep_shift_pixel_to_boundary_with_group_pixels)
rep_sptbwgp: rep_shift_pixel_to_boundary_with_group_pixels $*
#@cli rep_shift_pixel_to_boundary_with_group_pixels: -1<=_position<=1, _axis={ 0=Horizontal | 1=Vertical }, 0<=_influence_factor<=1, _threshold>=0,_channel_mode
#@cli : Shifts pixels to boundary by percentage using grouped pixels. position less than .5 means shift will be negative, and position greater than .5 means shift will be positive.
#@cli : Assign an argument to _channel_mode if you want to disable restricting effect on alpha channel or avoid manipulating 4 channels image in case of CMYKA image. Only use in rare cases!
#@cli : Default values: '_position=-1','_axis=1','_influence_factor=1','_threshold=0','_channel_mode='
rep_shift_pixel_to_boundary_with_group_pixels:
skip ${1=-1},${2=1},${3=.5},${4=0},${5=}

any_channels=0 #In context of PDN, you can ignore this#
tcr=3          #In context of PDN, you can ignore this#
influence_factor={min(abs($3),1)} #Determines the amount of effect to be applied#
position={(($1+1)/2)}             #Position shift of rows/column#
if   $position<0 position=0 #In context of PDN, you can ignore this#
elif $position>1 position=1 #In context of PDN, you can ignore this#
fi

if narg($5) #In context of PDN, you can ignore this#
    if $5>=0 
        tcr+=1
    else
        any_channels=1
    fi
fi #In context of PDN, you can ignore this#

if $influence_factor #Effect will apply if and only if influence factor is greater than 0#
repeat $! l[$>]
if (s==2||s>$tcr)||$any_channels #Ignore this#
ss={s-1}
sh $ss f. "i>$4?i:0" rm.                          #If alpha value is less than threshold, then alpha value is 0#
{w},{h},1,1,i(#-1,x,y,0,$ss)?1                    #Create new surface with alpha value#
if $2 {w},1,1,1,sum(crop(#-1,x,0,0,0,1,h#-1,1,1)) #Create horizontal vector if axis direction is vertical. Value of vector is equal to the sum of columns in the newly created surface prior to this one.#
else  1,{h},1,1,sum(crop(#-1,0,y,0,0,w#-1,1,1,1)) #Create vertical vector if axis direction is horizontal. Value of vector is equal to the sum of rows in the newly created surface prior to this one.#
fi
{w#-2},{h#-2},1,{$ss+1}                           #Create processing surface#

eval ${-math_lib}"
influence_factor="$influence_factor"; #Used for weighted average calculation#
invert_factor=1-influence_factor;     #Used for weighted average calculation#
position="$position";                 #Defines where the pixel will go#
if($2,                                #If pixel will shift vertically, then...#
    for(xx=0,xx<w#-1,xx++,            #Loop per pixel#
        nyy=h#-1-1;
        if(i(#-2,xx,0),
            N=i(#-2,xx,0);            #Use horizontal vector to find sum of column#
            tyy=h#-1-N;               #To make sure that shift do not go overbound#
            nyy-=tyy*position;        #This is what defines the position of pixels#
            for(yy=h#-1-1,yy>-1,yy--, #Loop per pixel#
                if(N,                 #If N is greater than 0, then...#
                    if(i(#-3,xx,yy),  #If there is an alpha value greater than 0 in surface number 2.#
                        N--;
                        tnyy=influence_factor*nyy+invert_factor*yy;          #Used weighted average to calculate final result#
                        if(position==1,I(#-1,xx,ceil(tnyy))=I(#-4,xx,yy);    #I had to use ceil or floor to avoid bugs#
                                      ,I(#-1,xx,floor(tnyy))=I(#-4,xx,yy);   #I had to use ceil or floor to avoid bugs#
                        );
                        nyy--;                                               #Used to place pixels with alpha greater than 0 on the edge of final image#
                    );
                ,break(); #Escape xx loop when N is 0#
                );
            );
        );
    );
,
    for(yy=0,yy<h#-1,yy++,
        nxx=0;
        if(i(#-2,0,yy),
            N=i(#-2,0,yy);
            txx=w#-1-N;
            nxx+=txx*position;
            for(xx=0,xx<w#-1,xx++,
                if(N,
                    if(i(#-3,xx,yy),
                        N--;
                        tnxx=influence_factor*nxx+invert_factor*xx;
                        if(position==1,I(#-1,floor(tnxx),yy)=I(#-4,xx,yy);
                                      ,I(#-1,ceil(tnxx),yy)=I(#-4,xx,yy);
                        );
                        nxx++;
                    );
                ,break();
                );
            );
        );
    );
);
"
k. #end result#
fi
endl done
fi

 

Edited by Reptillian

Share this post


Link to post
Share on other sites
42 minutes ago, Ego Eram Reputo said:

I've never heard of four surfaces being used. I'm sure it could be done. I'm just as sure there must be a less cumbersome way to do it.

I had to use G'MIC internal codes, hence 4 surface. That being said...

 

In context of C# and PDN: I think you only need two surfaces. The N value can be found by looping through current row/column and checking if alpha value is greater than 0, and if it is, N++. Then perform the shift found in codes deeper than N value code. Perhaps, it wasn't as straight forward even if it use the general for x,y codes. I may attempt to convert this as an alternative plugin to MadJik Gravity as this version has float-based influence and float-based position factors.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Fragment Blur has been moved from Testing to Degradation. Furthermore, I changed it so that half-hypotenuse is used instead because result don't change all that much, and you have higher degree of precision.

Share this post


Link to post
Share on other sites

Object Size Filtering has been upgraded. It's a bit harder to use now, but also far more flexible.

 

Other details:

1. I fixed descriptor for Nebulous

2. I have added credits to @Asmageddon Prince in Logarithmic Distortion series.

Edited by Reptillian
  • Like 1

Share this post


Link to post
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.

Guest
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.