Reptorian G'MIC Filters

get has been replaced with rep_bchstatfunc. bch is short for by channel. i did put a (eq. to ‘’) on its longer name for clarity, but i’ll do that after my photo mosaic filter.

Submitted pull requests to G’MIC Community Github

New GUI filters

  • Aspect Ratio Cropping
  • Picture Mosaic

New CLI commands

  • rep_mosaic_gen
  • rep_aspect_crop_2d
1 Like

Fixed formatting- New filters, and cli commands by Reptorian1125 · Pull Request #168 · dtschump/gmic-community · GitHub

I am not sure how exactly should I address the pal, and the statfunc series. There’s like 3 way to specify to use average for calculation, and that’s for convenience of coding. I’ll probably match the clut cli formatting for the pal series.

Aspect Ratio bug has been fixed or at least I think so despite numberous attempts with success and then fails in circumstantial situations. So, I’m not sure 100%, but this time it’s probably is fixed.

Also, I just got around mosaic filter bug though another bugs appear. Looks like I’ll have to recode the filter again. Sigh…


EDIT: I got the mosaic filter to work on GIMP, Krita, and Paint.NET! I have submitted commits to the github. And this happened after failing to make it work like a billion times. Note: You may have to enable autocrop to median to get it to work though at some circumstances, and I don’t why is this so, but you do.

Hello @Reptorian

I have just installed Krita, with today’s development version (4.2 pre-alpha) on Windows 10 (64 bit).

Whenever I try to apply your filter (emboss - relief, that is) a window pops up with a message: Sorry, this output is not implemented yet.
The preview in G’MIC 2.5.6 works fine though.
I have tried several images: jpeg, png etc

I suppose this filter is a work in progress. However, I wanted to let you know in case it is a real “bug” regarding this particular filter or Krita 4.2 alpha…

See this screenshot:

EDIT: just tried this same filter through Gimp 2.8.10 (Windows 10, as usual). It works fine! The filter is applied to the image (no window pops up)
Therefore, I suppose it is a Krita 4.2. pre-alpha glitch…

Yeah, Krita 4.2 does have that issue. It can create new layers, but that option doesn’t work. Anyways, I got news guys. I am back to Krita development.

The thing I am trying to see implemented are High Pass, and Pat David Luminosity Mask into Krita. I’m working on the second as I am having issue making high pass work (for reference into high pass, see here) - ⚙ D20475 High Pass Filter

The Pat David Luminosity Mask should be easy to do. Not sure about category thing though, but I found out that de-saturate can be used as the base for luminosity mask. I’m going to start a new thread here for Krita development.

Hello @Reptorian,

It can create new layers, but that option doesn’t work.

Therefore it is a bug…
I have taken a glance at the Krita bug tracker and only a few reports of G’MIC are listed on there which is kind of strange since G’MIC is far more unstable on Krita compared to Gimp 2.8.10.

Yesterday [1], I have done a few quick tests comparing Krita 4.2 pre-alpha and Gimp 2.8.10. It does look like G’MIC 2.5.6 is faster on Gimp: only tested the Rodilius filter, which is multi-threaded, with the same jpeg 2.2 Mb image and settings.

With Krita it also looks like there are some feature not implemented in the G’MIC GUIs compared to Gimp, such as the option to import many layers at once e.g. for the Montage filter where this feature is vital. At present, Krita 4.2 alpha even crashes if you try to set this option in the G’MIC GUIs

Unfortunately, these missing options are not apparently listed on the Krita web-page and it is extremely difficult to figure them out (at least I was unable to find them personally…)

[1] G'MIC 2.5.x: Krita 4.2 vs gimp 2.8.10 features

Actually, I can use multiple layers into Krita G’MIC. Otherwise, I wouldn’t have made mosaic filter.

Hello @Reptorian

Actually, I can use multiple layers into Krita G’MIC. Otherwise, I wouldn’t have made mosaic filter.

Thanks for testing!

I have checked this option on Windows 10 on more occasions during these past years and it has never worked for me. Either it completely crashed Krita or, more frequently, a window showed up and informed me this feature was not implemented so far.
I have even filed many bug reports on the Krita bug tracker :slight_smile:

Just tested again and, as usual, a window pops up informing me this ouptut mode is not implemened yet. At least, it does not crash Krita 4.2 pre-alpha…

Here is the screenshot (Window 10):

I suppose you are working on Linux. Perhahs this is the reason concerning the different outcome of this opiton?

I have never found a thorough list concerning the differences between the G’MIC GUIs developed on Gimp and Krita and I am testing both of them randomly…
Since the G’MIC QT Guis available with Gimp is developed directly by the French two developers of G’MIC I suppose it is much more stable and rich of options but it is only my supposition…

G’MIC QT works better for GIMP. It’ll be working fine on Krita some day when there’s the time for that. Maybe by 4.3 as the bugs are being cleared out on Krita. I’m back here because I couldn’t actually code up a functional filter for Krita. MixOP failed to work on my high pass filter attempt, and that’s the only thing that needs to work for High Pass to work on GrayA, XYZ, CMYK, RGB, LAB (Yes, Krita supports every of those color models, one of them though doesn’t have a open source icc profile, so that’s not well-supported) all at once.

I am testing this Paint.NET plugin - https://forums.getpaint.net/topic/114080-emboss-effect-testing/?tab=comments&_fromLogin=1

What I found out what PS Emboss does. Convolution technique or box filtering technique are not used -

I believe PS Emboss can be replicated easily via G’MIC. In fact, I will be starting the attempt. I also can improve my emboss filter by applying the effect across different channels, and it’ll look something like PS Emboss.


EDIT: Added two new cli commands - PS Emboss Inspired Filter and new CLIs by Reptorian1125 · Pull Request #170 · dtschump/gmic-community · GitHub The second one is going to be used to replicate PS Emboss


EDIT: And I did it. PS. I have no idea why is there’s that weird border indicator though.

EDIT: Ok, I created a new GUI filter based on PS Emboss though I don’t know how to get CMYK working yet, but that’s not a big deal for now.

1 Like

Made a new filter called fragment blur. It’s a better version of the Paint.NET Fragment Blur implementation.

Here’s the reference picture from pexels

Result with G’MIC Fragment Blur made by me

That is the vision I get when I see stock photos with a generic attractive person.

1 Like

Now, I think the filter is ready now that Alpha processing works.

Is it possible to do something like this?

f[0] “i2((i#0/255w#0),(i#1/255w#1))”

There are 3 images in total. I want to change the i#0 image based on the value found in i#2(x,y). It’s kind of a blending mode, but you’re using images and coordinate instead of expression. The value represent x,y. The greater the value, the greater the coordinate.


P.S

Found it.

 rv to_rgb[^0] f[0] "i(i#2/255*w#1,i#1/255*h#1)"

The above will blend the two image as if the image was the blending mode.

Now, I am going to try to convert values generated from my rep_reversespiralbwcoormap command into a formula based value since it is the only way to bypass dynamic array limitation of 4096^2. Yes, I kid you not on trying to convert 2 variable dynamic array into 1d function. It’s basically interconnected slope where height defines slopes close to 90 degrees.

That’s going to be very tough to do.
First I have to create two svg lines, then I have to analyze it and theorize until all in the clear. It the theorizing stage that’s going to be hard.

— Gave up on doing it, was taking too much of my time even though I believe my theory can work. Went to code in a output error message if dynamic array insertion stops working. It stops working after sqr(4096) or sqr(2^12). Ideally, (2^16)*(2^16) should be the limit if there has to be one. I may be back to another attempt after a month later.

Since the rep_reversespiralbwcoordinatemap command is on hold.

I worked on replicating nebulous Paint.NET plugin -

iw={w}
ih={h}
channels 0

if $iw>$ih r $iw,$iw,1,1 
else r $ih,$ih,1,1 fi

f "
IX=(x/w-.5)*2; #Output Gradient that goes from value -1,1 from the left to the right#
IY=(y/h-.5)*2; #Output Gradient that goes from value -1,1 from the top to the bottom#
IX*=12*4;
IY*=12*4;
k=pi+1.5;
ang=270*pi/180;
ti=sin(atan2(IX,IY))*cos(sqrt(IX*IX+IY*IY))+k+sqrt(IX*IX+IY*IY)+ang;
g=(sin(ti)+sin(pi/2+ti)+sin(pi+ti));
"
n 0,255
modf 3,255,.25
negate

The surface this gives me is this -

image

I’ll admit, it’s not exact.

PS. Never mind, I solved it. +k was supposed to be *k

Soon, G’MIC will have Nebulous Paint.NET plugin.

Code so far


iw={w}
ih={h}
channels 0

if $iw>$ih r $iw,$iw,1,1 
else r $ih,$ih,1,1 fi

f "
IX=(x/w-.5)*2;
IY=(y/h-.5)*2;
IX*=12*4;
IY*=12*4;
k=pi+12/10;
ang=0*pi/180;
ti=sin(atan2(IY*-1,IX))*cos(sqrt(IX*IX+IY*IY))*k+sqrt(IX*IX+IY*IY)+ang;
g=(sin(ti)+sin(pi/2+ti)+sin(pi+ti));
"
+ 1 * 128

The surface looks like this - Exactly like the PDN version

image

2 Likes

The first image gives me the CD effect when I scroll up and down. Very fun.

Any idea on how I can solve the distortion offset? It been getting on my nerve.

#@cli rep_nebulous: _rings>0,zoom_scale_x>0,zoom_scale_y>0,-100<=x_center[%]<=100,-100<=y_center[%]<=100,0<=_fxyangle<=360,_wave,0<=_lighting_angle<=360,_disturbance>=0,_distx,_disty,_subpixelevel,0<=_subpixelprocessingmethod<=4
#@cli : Default value: 'fxyangle=0','wave=1','lighting_angle=0','disturbance=0','distx=0','disty=0','subpixellevel=2','subpixelprocessing=1'
rep_nebulous:
skip ${6=0},${7=1},${8=0},${9=0},${10=0},${11=0},${12=2},${13=3}

if $1==0||$2==0||$3==0 v + error "Zoom scaling variable cannot be zero!" fi
if $9<0 v + error "Disturbance factor cannot be less than 0!" fi

iw={w}
ih={h}
channels 0

if $iw>$ih r {$iw*$12},{$ih*$12},1,1 
else r {$iw*$12},{$ih*$12},1,1 fi

f "
sd=w/h;
shx=($4*w)/2;
shy=($5*h)/2;
ang=pi*$6/180;
ix=((x+shx)/w-.5)*2/(h>w?1/sd:1);
iy=((y+shy)/h-.5)*2/(w>h?sd:1);
IX=ix*cos(ang)-iy*sin(ang);
IY=ix*sin(ang)+iy*cos(ang);
IX*=$1*4*(1/$2);
IY*=$1*4*(1/$3);
distlvl=$9;
dist=pi/(distlvl/100);
disth=$10;
distv=$11;
cx=x-w/2;
cy=y-y/2;
IX+=distlvl>0?(disth*(sin(((cx/10+cy/10)/2)/dist)-cos(((cy/10-cx/10)/2)/dist)));
IY+=distlvl>0?(-distv*(sin(((cx/10+cy/10)/2)/dist)+cos(((cy/10-cx/10)/2)/dist)));
k=pi+((-pi+(pi*$7))*10)/10;
ld=$8*pi/180;
ti=sin(atan2(IY,IX))*cos(sqrt(IX*IX+IY*IY))*k+sqrt(IX*IX+IY*IY)+ld;
g=(sin(ti)+sin(pi/2+ti)+sin(pi+ti));
"

if $iw>$ih r $iw,$ih,1,1,{$13+2}
else r $iw,$ih,1,1,{$13+2} fi

When I do +rep_nebulous 12,1,1,{300/2/w},0,0,1,0,10,30,0 n 0,255

blend difference

I noticed that there might be a way to solve the distortion offset. You see a relationship between some variable here?

Figured out distortion displacement. By the way, I got this from the cli I’m working on.

image

The PDN result

1 Like

Ready for testing now.

https://github.com/dtschump/gmic-community/pull/176/files

@afre How do you feel about the order? I’m not too sure about it. Depending on your answer, if the order is bad, then I"ll change it. It doesn’t behave exactly like the PDN version, but I tried my best anyway and it works, and that is what matters. I’m satisfied with it regardless.

@David_Tschumperle Mentioning you since I didn’t want it to be pushed until the order is ok.


P.S. Result

1 Like

I think the parameter order of the PDN version makes more sense.

I am still learning how to use GitHub. When I made my first pull request, I noticed that one could do a draft that cannot be committed.