Reptillian

Reptorian's G'MIC Code Workshop

Recommended Posts

3 hours ago, Seerose said:

❤️ Dear @Reptillian and @null54!

 

Gmic collection. zip, I opened it, I don't know where the folder is.

That .zip file is a collection of note in gmic code form. It's only for scripters and programmers. Some of them can be copied and pasted into Custom Code gui filter.

 

If you really want to code within g'mic scripting, I would start with downloading KDE Kate and open those files with KDE Kate (That is what I use), look into Custom Code filters under Various under gmic-qt plugin under paint.net. Then, use the g'mic reference, and read tutorials on how to code. In a way, it's a lot easier to code in filters with gmic-qt than it is to work with c# or c++.  Another source you can use to learn it is to read G'MIC-QT STDLIB or look at the g'mic-community repository. Almost every codes I done for g'mic-qt is found within reptorian.gmic. If you need more help, I would ask discuss.pixls.us forum, and they'll help you understand how everything works better than I can.

 

 

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites


I got news. Where I'm at, hospitals are getting filled with COVID-19 patients and in fact, less than 10 counties have hospitals at 10- percent capacity. Actually, I do not think it would be wise to try to find a job when I already have a roof over me. So, I will code up a few things.

  • Like 3

Share this post


Link to post
Share on other sites
On 7/8/2020 at 7:51 AM, Reptillian said:

hospitals are getting filled with COVID-19 patients

Stay safe, stay at home if you can.

 

On 7/8/2020 at 7:51 AM, Reptillian said:

So, I will code up a few things.

That is good news, you are our only G'MIC coder on the forum. (I did not forget @null54)

Share this post


Link to post
Share on other sites

Here's what I have coded in. Paste it into code filter under G'MIC-QT->Various section and see what you get. You get this image:

 

99f4525a635e977b1eab3897700eae0327d03f02

rep_pfrac 100,1,.25,10,1,0,0,0,1,0,0,1
rep_pfrac: rep_popcorn_fractal $*
#$1==points_per_pixels#
#$2==density#
#$3==H#
#$4==K#
#$5==zoom#
#$6==rotation_angle#
#$7==origin_x#
#$8==origin_y#
#$9==formulamode#
rep_popcorn_fractal:
skip ${1=50},${2=1},${3=.05},${4=3},${5=1},${6=0},${7=0},${8=0},${9=0},${10=},${11=},${12=},${13=},${14=},${15=}
f 0 r 100%,100%,1,1
repeat $! l[$>]
    eval ${-math_lib}"
    const pts=$1;
    const density=1/$2;
    const H=$3;
    const K=$4;
    const zoom=1/$5;
    const ang=($6/180)*pi;
    const origin_x=$7*-1*zoom;
    const origin_y=$8*zoom;
    const sd=max(w,h)/min(w,h);
    const sx=w>h?sd:1;
    const sy=w>h?1:sd;
    const cx=w/2;
    const cy=h/2;
    const ocx=origin_x*cx;
    const ocy=origin_y*cy;
    const angcondition=($6-360*floor($6/360))?1;
    rot_x(a,b)=a*cos(ang)-b*sin(ang);
    rot_y(a,b)=a*sin(ang)+b*cos(ang);
    if(!$9,
        if(narg($10),
            if(($10%3)==0,func_a(a)=sin(a);,
            if(($10%3)==1,func_a(a)=cos(a);,
            if(($10%3)==2,func_a(a)=tan(a);
            );
            );
            );,
        func_a(a)=sin(a);
        );
        if(narg($11),
            if(($11%3)==0,func_b(a)=sin(a);,
            if(($11%3)==1,func_b(a)=cos(a);,
            if(($11%3)==2,func_b(a)=tan(a);
            );
            );
            );,
        func_b(a)=tan(a);
        );
        if(!narg($12),
            if(narg($10),
                if(($10%3)==0,func_c(a)=sin(a);,
                if(($10%3)==1,func_c(a)=cos(a);,
                if(($10%3)==2,func_c(a)=tan(a);
                );
                );
                );,
            func_c(a)=sin(a);
            );,
        if(($12%3)==0,func_c(a)=sin(a);,
        if(($12%3)==1,func_c(a)=cos(a);,
        if(($12%3)==2,func_c(a)=tan(a);
        );
        );
        );
        );
        if(!narg($13),
            if(narg($11),
                if(($11%3)==0,func_d(a)=sin(a);,
                if(($11%3)==1,func_d(a)=cos(a);,
                if(($11%3)==2,func_d(a)=tan(a);
                );
                );
                );,
            func_d(a)=tan(a);
            );,
        if(($13%3)==0,func_d(a)=sin(a);,
        if(($13%3)==1,func_d(a)=cos(a);,
        if(($13%3)==2,func_d(a)=tan(a);
        );
        );
        );
        );
        popcorn_x(a,b)=a-H*func_a(b+func_b(K*b));
        popcorn_y(a,b)=b-H*func_c(a+func_d(K*a));
    ,
        if(narg($10),
            if(($10%3)==0,func_a(a)=sin(a);,
            if(($10%3)==1,func_a(a)=cos(a);,
            if(($10%3)==2,func_a(a)=tan(a);
            );
            );
            );,
        func_a(a)=sin(a);
        );
        if(narg($11),
            if(($11%3)==0,func_b(a)=sin(a);,
            if(($11%3)==1,func_b(a)=cos(a);,
            if(($11%3)==2,func_b(a)=tan(a);
            );
            );
            );,
        func_b(a)=cos(a);
        );
        if(narg($12),
            if(($12%3)==0,func_c(a)=sin(a);,
            if(($12%3)==1,func_c(a)=cos(a);,
            if(($12%3)==2,func_c(a)=tan(a);
            );
            );
            );,
        func_c(a)=tan(a);
        );
        if(!narg($13),
            if(narg($10),
                if(($10%3)==0,func_d(a)=sin(a);,
                if(($10%3)==1,func_d(a)=cos(a);,
                if(($10%3)==2,func_d(a)=tan(a);
                );
                );
                );,
            func_d(a)=sin(a);
            );,
        if(($13%3)==0,func_d(a)=sin(a);,
        if(($13%3)==1,func_d(a)=cos(a);,
        if(($13%3)==2,func_d(a)=tan(a);
        );
        );
        );
        );
        if(!narg($14),
            if(narg($11),
                if(($11%3)==0,func_e(a)=sin(a);,
                if(($11%3)==1,func_e(a)=cos(a);,
                if(($11%3)==2,func_e(a)=tan(a);
                );
                );
                );,
            func_e(a)=cos(a);
            );,
        if(($14%3)==0,func_e(a)=sin(a);,
        if(($14%3)==1,func_e(a)=cos(a);,
        if(($14%3)==2,func_e(a)=tan(a);
        );
        );
        );
        );
        if(!narg($15),
            if(narg($12),
                if(($12%3)==0,func_f(a)=sin(a);,
                if(($12%3)==1,func_f(a)=cos(a);,
                if(($12%3)==2,func_f(a)=tan(a);
                );
                );
                );,
            func_f(a)=tan(a);
            );,
        if(($12%3)==0,func_f(a)=sin(a);,
        if(($12%3)==1,func_f(a)=cos(a);,
        if(($12%3)==2,func_f(a)=tan(a);
        );
        );
        );
        );
        popcorn_x(a,b)=a-H*func_a(b+func_b(K*b+func_c(K*b)));
        popcorn_y(a,b)=b-H*func_a(a+func_b(K*a+func_c(K*a)));
    );
    for(ix=0,ix<w,ix+=density,
        for(iy=0,iy<h,iy+=density,
            xx=zoom*(ix-cx)/cx;
            yy=zoom*(iy-cy)/cy;
            xx*=sx;
            yy*=sy;
            xx+=origin_x;
            yy+=origin_y;
            for(ptn=0,ptn<pts,ptn++,
                xnew=popcorn_x(xx,yy);
                ynew=popcorn_y(xx,yy);
                xval=((xnew-origin_x*sx)*cx/zoom+cx*sx)/sx;
                yval=((ynew-origin_y*sy)*cy/zoom+cy*sy)/sy;
                if(angcondition,
                    temp_xval=xval-cx+ocx;
                    temp_yval=yval-cy+ocy;
                    xval=rot_x(temp_xval,temp_yval)+cx-ocx;
                    yval=rot_y(temp_xval,temp_yval)+cy-ocy;
                );
                if((round(xval)>=0&&round(yval)>=0)&&(round(xval)<w&&round(yval)<h),
                    i(#0,round(xval),round(yval),0,0)+=1;
                );
                xx=xnew;
                yy=ynew;
            );
        );
    );
    "
endl done

 

Edited by Reptillian
  • Like 1

Share this post


Link to post
Share on other sites

36df1c76a24e2c624aee0de78f1377092319d0d9

Released new filter called Edge Fade. It is similar to PDN plugin named Edge Fader Extreme. However, my version is a more precise filter with the option of localized normalization preprocessing step. That means it can work in dusty alphas. It is more precise as it use a circular eroding pattern, and subpixel processing.

 

Photo is from Helena at Pexels.

Edited by Reptillian
  • Like 2
  • Upvote 2

Share this post


Link to post
Share on other sites

For anyone that tried the Edge fade filter, is it too slow? It would finish in less than a minute on a 420x420 image on my own machine. The algorithm currently use upscaling for increased precision.

Share this post


Link to post
Share on other sites
29 minutes ago, Reptillian said:

For anyone that tried the Edge fade filter, is it too slow? It would finish in less than a minute on a 420x420 image on my own machine. The algorithm currently use upscaling for increased precision.

Yes, I found it to be extremely slow, I tried it on a 500x500px image and on the both times I tried it, I got a "Preview Timeout" prompt on the GUI.

Share this post


Link to post
Share on other sites

 

1 hour ago, Reptillian said:

For anyone that tried the Edge fade filter, is it too slow?

 

I also had a "Preview Timeout". Perhaps because I have a very old PC it took over 5 minutes to render once I pressed the OK button. I am very impressed by the final result but frustrated by the time it took.

Share this post


Link to post
Share on other sites

@Djisves @Eli @nitenurse79 @Seerose @lynxster4

 

Sorry for the slow filter! I have pushed a faster version utilizing squared-euclidean distance calculation. Now it finish in 3 seconds on my machine. If it slow and takes 3+ minutes, then it haven't been updated. It even looks much nicer too!

 

Commit here - https://github.com/dtschump/gmic-community/commit/637d4ef3af548b892a1f50b20d6cd024675da645

Edited by Reptillian

Share this post


Link to post
Share on other sites
On 7/15/2020 at 7:17 PM, Reptillian said:

Added some more changes to Edge Fade. It now respect the boundary of distance. Meaning your image will not disappear.

 

Thanks, that is a big improvement. The new version renders much faster :) 

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