Reptorian G'MIC Filters

I can confirm that 4+ channeled images don’t pass through properly.

I have increased speed of distortion filters, nebulous, and Thorn Fractal. Those changes been pushed. Also Thorn Fractal has new formulas which are named “alternating chaos”. I might make more changes to Thorn Fractal as I plan to insert $1-38 as a begin variable.

Now I realized why.

0 << 2 = 0. The part about 0 is what cause this issue. So, if I want RGBA, I would have to go by another way of placing them into RGBA.

:face_with_raised_eyebrow: Is that the source of your trouble? Unless I am mistaken, you are modifying the pixel values and returning them back to their normal state. Shouldn’t 0s remain 0s?

… Unless you made something a 0 that wasn’t a 0 in the first place… That would do it.

Yes, I believe that’s why I couldn’t convert the alpha back to normal. I don’t know how to get around that issue other than to find another conversion route. The only hint of doing that is to do what I did with color distribution filter. If I can find a way to do a 4 channel version of that, I’m golden, but the problem is that I need to work with math.

You would need to do some tricks. One that I might try is remember which pixels you have made into 0s and process them differently. I have done it to varying degrees of success; i.e., it can get unwieldy. In any case, let me know how you solve the problem once you do, in simple terms of course. It is an interesting problem you have there. Good luck.

I’ll have to figure that problem later.

New filter is coming very soon! I replicated TR’s Intense Filtration plugin for Paint.NET

image


EDIT: Another new filter is coming. I know someone will love it.


EDIT: Backing up code. Feel free to use it or make changes.

#@cli rep_gv: (eq. to rep_glass_vignette)
rep_gv: rep_glass_vignette $*
#@cli rep_glass_vignette: refraction,chromatic_aberration,upscale_coordinate,angle,preliminary_shift_x,preliminary_shift_y,subpixel,boundary,interpolation,colorspace
#@cli : Distorts images as if it is based from the view of a bulged car mirror or camera glass. This G'MIC filter is a extended version of TR's Glass Vignette plugin originally made for Paint.NET.\n
rep_glass_vignette:
convert_back=0
subpixel={1+abs($7)}
repeat $! l[$>]
if (s==3||s==4)&&$10
    convert_back=1
    if $10!=4
        sh 0,2
        if $10==1 rgb2srgb.
        elif $10==2 rgb2ryb.
        elif $10==3 rgb2cmy.
        elif $10==5 rgb2hcy.
        elif $10==6 rgb2hsi.
        elif $10==7 rgb2hsl.
        elif $10==8 rgb2hsv.
        elif $10==9 rgb2lab.
        elif $10==10 rgb2lch.
        elif $10==11 rgb2yiq.
        elif $10==12 rgb2yuv.
        elif $10==13 rgb2ycbcr.
        elif $10==14 rgb2ycbcrglic.
        elif $10==15 rgb2xyz.
        fi
        rm.
    else
        if s==3 rgb2cmyk
        elif s==4 s c,-3 rgb2cmyk.. a c
        fi
    fi
fi
shift $5,$6,0,0,$8,{(abs($9)-1)?1}
r2dx {$subpixel*100}%,{abs($9)+1}
f "begin(
aberate=((1-$1)-.001)/.999;
aberate=sqr(1*aberate+(1-$2)*(1-aberate));
ang=pi*($4/180);
rot_x(a,b)=a*cos(ang)-b*sin(ang);
rot_y(a,b)=a*sin(ang)+b*cos(ang);
sq2(a,b)=sqrt(a^2+b^2);        
sd=max(w,h)/min(w,h);
sx=w>h?sd:1;
sy=w>h?1:sd;
rx(a)=((a/2+.5*sx)/sx)*w;
ry(a)=((a/2+.5*sy)/sy)*h;        
cv=sq2(rot_x(sx,sy)/2,rot_y(sx,sy)/2);
off_x_primary(a,b)=cos(a)*b*(abs($3)+1);
off_y_primary(a,b)=sin(a)*b*(abs($3)+1);
off_secondary(a,b,c)=a*(1-c)+b*c;
);
xx=(x/w-.5)*2;
yy=(y/h-.5)*2;
xx*=sx;
yy*=sy;
XX=rot_x(xx,yy);
YY=rot_y(xx,yy);
far=sq2(XX,YY);
rad=atan2(YY,XX+.0001);
eff=far/cv;
RB=far^(1-$1);
RA=RB*aberate;
off_xS=off_x_primary(rad,far);
off_xA=off_x_primary(rad,RA);
off_xB=off_x_primary(rad,RB);
off_yS=off_y_primary(rad,far);
off_yA=off_y_primary(rad,RA);
off_yB=off_y_primary(rad,RB);
offxA=off_secondary(off_xS,off_xA,eff);
offyA=off_secondary(off_yS,off_yA,eff);
offxB=off_secondary(off_xS,off_xB,eff);
offyB=off_secondary(off_yS,off_yB,eff);
fax=rx(offxA);
fay=ry(offyA);
fbx=rx(offxB);
fby=ry(offyB);
if(s==1,result=[i((fax+fbx)/2,(fay+fby)/2,z,1,(abs($9)-1)?1,$8)]);
if(s==2,result=[i(fbx,fby,z,0,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,1,(abs($9)-1)?1,$8)]);
if(s==3,result=[i(fbx,fby,z,0,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,1,(abs($9)-1)?1,$8),i(fax,fay,0,2,(abs($9)-1)?1,$8)]);
if(s==4,result=[i(fbx,fby,z,0,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,1,(abs($9)-1)?1,$8),i(fax,fay,0,2,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,3,(abs($9)-1)?1,$8)]);
if(s==5,result=[i(fbx,fby,z,0,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,1,(abs($9)-1)?1,$8),i(fax,fay,0,2,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,3,(abs($9)-1)?1,$8),i((fax+fbx)/2,(fay+fby)/2,z,4,(abs($9)-1)?1,$8)]);
result;
"
r2dx {(1/$subpixel)*100}%,{abs($9)+1}
if $convert_back
    if $10!=4
        sh 0,2
        if $10==1 srgb2rgb.
        elif $10==2 ryb2rgb.
        elif $10==3 cmy2rgb.
        elif $10==5 hcy2rgb.
        elif $10==6 hsi2rgb.
        elif $10==7 hsl2rgb.
        elif $10==8 hsv2rgb.
        elif $10==9 lab2rgb.
        elif $10==10 lch2rgb.
        elif $10==11 yiq2rgb.
        elif $10==12 yuv2rgb.
        elif $10==13 ycbcr2rgb.
        elif $10==14 ycbcrglic2rgb.
        elif $10==15 xyz2rgb.
        fi
        rm.
    else
        if s==4 cmyk2rgb
        elif s==5 s c,-4 cmyk2rgb.. a c
        fi
    fi
fi
endl done
1 Like

@Reptorian,

Nice filter(s). :grinning:

I think TR’s Pixel Sharpener Plugin is great too, perhaps this filter can also be translated to G’MIC, if it has your interest of course.

NB. There are G’MIC filters that look similar:
Jérôme Boulanger’s “Local Variance Normalization” (this filter looks most similar)
Garagecoder’s “Deblure Texture”
and Iain Fergusson’s “Constrained Sharpen”

My knowlege of algorithms is null, so I don’t know if some algorithms in filters here above resemble algorithms in TR’s filter.

That was way too easy. Made a pull request.

1 Like

Hello @Reptorian

That was way too easy. Made a pull request.

How did you name this new filter (TR’s Pixel Sharpener) of yours?

BTW, I have just taken a look at your collection of filters available with GIMP 2.10.14 and G’MIC 2.7.5.
There are heaps of them: their huge list is astounding, to say the least!

THANKS a lot for releasing them for everyone’s pleasure!
You really make the world a better place… :slight_smile:

The same name as the algorithm was provided by him.

Hello @Reptorian

Thanks.
I have previously searched for “Pixel Sharpener” in your collection (GIMP + G’MIC 2.7.5) but it was not available yet.
Therefore, I suppose I only need to wait some more time in order to have it ready to be downloaded :slight_smile:

You need to upgrade to 2.8.0 to be able to get new filters.

The Pixel Sharpener is not going to arrive until tomorrow or two days for 2.8.

@Reptorian,

Thank you very much for doing this. I think you will appreciate the artifacts this filter gives/shows, as does the original filter in Paintnet. (stronger sharpening, more artifacts)

edit: The original filter only has photo,horizontal and vertical motion. Is it possible to program a free angle?

The artifacts will be less when you can also select colorspaces, lab-l for example.
Again, great that you have translated this into G’MIC.

All of those are possible, and they have been added.

Pull Request - Added iarga feature requests to TR's Pixel Sharpener ; New Command rep_equi2cube by Reptorian1125 · Pull Request #224 · dtschump/gmic-community · GitHub

1 Like

Super!

I released new cli command called rep_equi2cube into the same pull request as the extended version of TR’s Pixel Sharpener. However, I didn’t make the reverse version yet. After that, I will do gui filter. Here’s the picture using new command (Top is input, bottom is output). As you can see, you can specify the location of top and bottom. It could be extended even further, but it’s not needed.

1 Like

Thank you for the changes. You made use of dynamic gui capabilities in G’MIC :smiley:. I like the angle slider that pops up. The ability to change sharpness at an angle with one or two axis is more useful than I had previously thought. (I copied it from github for now)

1 Like

Might write some unruly code but @Reptorian is the real deal. :biking_man::stuck_out_tongue_closed_eyes:

1 Like