Reptorian G'MIC Filters

Here is something that seems to work with Gimp :

#@gui Emboss-ReliefTEST : fx_emboss_reliefTEST, fx_emboss_reliefTEST(0)
#@gui : Enable Extreme Emboss or Relief? = bool(0)
#@gui : Angle = float(0,0,360)
#@gui : Depth (%) = float(100,0,500)
#@gui : Depth (%) = float(100,0,5000)
#@gui : Smoothness = float(0,0,10)
#@gui : Invert Embossing? = bool(0)
#@gui : Preserve Alpha? = bool(1)
#@gui : sep = separator(), note = note("Relief Section")
#@gui : Apply Relief? = bool(1)
#@gui : Blending Opacity (%) = float(100,0,100)
#@gui : sep = separator(), note = note("<small>Author: Reptorian.      Latest Update: <i>2019/3/19</i>.</small>")

fx_emboss_reliefTEST : 

split_opacity
if $8 
+em {$6?$2+180:$2},{$1?$4/100:$3/100},$5 
blend grainmerge,{$9/100} 
else 
em {$6?$2+180:$2},{$1?$4/100:$3/100},$5 
blend grainmerge,{$9/100} 
fi 
if $7 
a
c 
else 
k
fi

Earlier comment removed for update


@samj @Silvio_Grosso - I just made a pull request on g’mic-community though I have to admit the original was working fine on my end. Something’s probably is up on my end, then. Could you verify that it does work?

Can you update your new version of this filter on

There are 2 illustrated problems as follows :

I don’t have any idea what’s going on here nor I don’t know how to fix it, so I can’t update it. It doesn’t really help that the code does work on my end of things. I had to add repeat around because the suggested code didn’t work on multiple layer, and changed a few thing because the result wasn’t suppose to look nearly white.

Let’s see here…

fx_emboss_relief : repeat $! l[$>] split_opacity if $8 +em[0] {$6?$2+180:$2},{$1?$4/100:$3/100},$5 blend[^1] grainmerge,{$9/100} else em[0] {$6?$2+180:$2},{$1?$4/100:$3/100},$5 fi if $7 a c else k[0] fi endl done

1. "repeat $! endl done" provides the way to loop the effect on each layer
2. split_opacity split into "rgb" and "alpha" layer.
3. when $8, then, add embossing layer which makes 3 layer, then blend excluding alpha layer (alpha layer is -2). 2 layer in the end. After that, you either append rgb to alpha or remove alpha altogether. 
4. When not $8, em simply affects the rgb layer and does nothing else. After that, you either append rgb to alpha or remove alpha altogether.

My interpretation could be wrong, I’ll admit that. If it is, then I have no idea where.

I applied your change Emboss Bug fix for GIMP 2.10.8 G'MIC by Reptorian1125 · Pull Request #163 · dtschump/gmic-community · GitHub
then I added ‘to_a’ at the beginning of your script for images that do not have an alpha channel :

1 Like

I didn’t know about the to_a command. I guess, it’s settled then! We have the final solution that allows it to work universally. Thank you very much!

You will find descriptions in this document :
https://raw.githubusercontent.com/dtschump/gmic/master/src/gmic_stdlib.gmic

#@cli to_a
#@cli : Force selected images to have an alpha channel.
to_a :
  e[^-1] "Force image$? to have an alpha channel."
  v - repeat $! l[$>]
    if {s==1||s==3} channels 0,{s} sh. {s-1} f. 255 rm. fi
  endl done v +

New cli command ’ get’ - New cli command get by Reptorian1125 · Pull Request #165 · dtschump/gmic-community · GitHub

#@cli get : variable,resize_bool[0=Do not resize | 1= Resize to 1x1],new_layer_bool[0=Do not resize | 1= Resize to 1x1]
#@cli : Creates 1x1 image based on defined variables that depends on image value (minimum, maximum, average, variance, sum, product and median)
get :
v - _gmic_s="$?" v +
_$0 $"*"
_get :
skip ${2=1},${3=1}
v - mvcma="$1"
if {isval("$1")} if {isint("$1")} mvcma=${arg\ 1+$1,min,max,avg,var,sum,pro,med} fi fi
if $3 v - +_get_$mvcma $2 else v - _get_$mvcma $2 fi
_get_im : _get_min $1
_get_minimum : _get_min $1
_get_min : s c f "im" a c if $1 r 1,1,1,{s},1 fi
_get_iM : _get_max $1
_get_maximum : _get_max $1
_get_max : s c f "iM" a c if $1 r 1,1,1,{s},1 fi
_get_ia : _get_avg $1
_get_average : _get_avg $1
_get_avg : s c f "ia" a c if $1 r 1,1,1,{s},1 fi
_get_iv : _get_var $1
_get_variance : _get_var $1
_get_var : s c f "iv" a c if $1 r 1,1,1,{s},1 fi
_get_is : _get_sum $1
_get_total : _get_sum $1
_get_sum : s c f "is" a c if $1 r 1,1,1,{s},1 fi
_get_ip : _get_pro $1
_get_product : _get_pro $1
_get_pro : s c f "ip" a c if $1 r 1,1,1,{s},1 fi
_get_ic : _get_med $1
_get_median : _get_med $1
_get_med : s c f "ic" a c if $1 r 1,1,1,{s},1 fi

Honestly, get is an awful command name, you should consider renaming it to something more meaningful.

Yes, I mentioned this before… I also prefer that you add a prefix to your commands; e.g., rep_get.

1. We know who wrote it.
2. We know that it is a community filter.
3. Less of a chance of a naming conflict.

1 Like

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