G'MIC in GEGL and multi image operations

Hi :slight_smile:

So I spent some time on making it possible to leverage from Aux input pad in GEGL operations and I think I have some kind of working version of it.

Now it could be possible to use it for many cases where at least two inputs are taking a part. In order to make it work I had to introduce a dedicated GEGL operation property “Aux Mode” which is an enum and can be one of given values:

  • Input ROI as Output ROI - in this mode both input and aux pads are used in G’MIC processing but the input boundaries are used as output,
  • As Output ROI - similar like the previous one but this time aux boundaries are used this time for output bounding box,
  • As Output ROI only - in this mode the aux input is used only to determine the output bounding box and only input pad is included in G’MIC processing

Various scenarios are possible now, first example for alpha blending:

this shows a default mode, in which the input pad determines the output boundary. In this flow the input Hat.png is much bigger than the capibara so it had to be scaled and cropped accordingly with GEGL operations :wink:

Second example:

Here I use upscaling via G’MIC, but there is a catch here - GEGL does not allow to dynamically modify the boundary after processing is done, and here we make the image twice it’s original size so the correct, doubled bounding box has to be provided and this is achieved by scaling an empty buffer and passing it into aux pad set to “As Output ROI only” so it wont be processed by G’MIC itself.

I’d like to hear your opinion :wink: I know it might look kinda exotic tho hehe.

BR,
activey

1 Like

Works also quite well with generated operations :slight_smile:

The input image has original dimensions of 768x512

Hello @activey , that looks really good, thanks for your work!

Cough Sorry, what did I just read? :sweat_smile:

Seems like that will slightly complicate the use of G’MIC filters that needs to have an output image that is different than the input.
But if this is by design… It’s already super cool you have found a workaround for that !!

Kudos!

1 Like

Btw, you can find the status page here:

1 Like

That’s interesting.
I’m wondering if that could be interesting to have an checkbox option, checked by default, that automatically resizes the output image with the same size as input.

Of course, this wouldn’t have much sense to use for some filters (part. upscaling filters), but for others, that could be a quite acceptable solution (I think of fx_array_random for instance).
There are a few filters that just slightly change the dimension of the input (adding a few pixel wide here and there), and for those, having this auto-resize output option would definitely make sense (I think of the various Frames filters for instance).

Note that you can use G’MIC itself to do that, by doing something as:

WH:=w,h fx_something arg1,arg2,... gui_merge_layers r $WH,1,100%,2

Behavior :

  • If the output image is larger than the input, it uses a nice “moving average method” to reduce the resolution.
  • If the output image is smaller than the input, it uses a nearest-neighbor interpolation (which seems to be a good default for this case, as any other interpolation will introduce smoothing).

What do you think, @activey ?

PS : And if this option is unchecked, there is always the ‘Aux’ trick that can be used.

I need to check but it sounds promising :slight_smile: Thanks!

I just tried it and it works perfectly :slight_smile:

1 Like