G'MIC Frame Blur

Recently I’m using to complete my filters the G’MIC Frame Blur, which I like.
I have one question: the frame is properly and nicely applied to the outcome all around. Unfortunately the layers below the final one are enlarged expanding the size not all around but totally to the right and the bottom of the existing layer contents.
My question is: could it be possible to have all the layers properly aligned?
Thanks a lot

Forgot to say that I use G’MIC filter(s) inside Gimp filters.

Hi,

If you don’t need to keep the original as a layer you can change output mode to new image, as this won’t enlarge your original image/layer. Otherwise it would need some code modifications i think (shift? …autocrop?).

Obviously.
But my way of creating gimp filter is:

  • create a new image from the original source
  • apply a set of modifications, which create additional layers
  • at end call GMIC frame to create the top layer
  • let to the user the option of applying personal modifications to the layer if (s)he like so, otherwise flatten the image in which case there is no problem of having all layers set to same configuration.
    I know also that I can do the modifications to the below layers (translate), and that is was I do if I want to get what I asked.
    But I guess that it would be appreciated if this result is obtained by the Frame filter itself.
    That’s the reason of my request.
    Thanks for your reply.

I see… (I gave it a try)
You got this

If it can help, a way to bring all other layers in the center of the image.

What I did is I selected all with the Alignment tool > Relative to Image and the 2 buttons to center 1 Vertically and the other one horizontally, all layers where centered at once.

I’m aware, It is not what you might expect, but this can be a trick when your script has finished or at the end to run?

Interesting, Patrice.
I tried but likely did not follow correctlyt the steps.
Could write down step by step the flow?
From the image it seems:
1- the top layer is set not visible: by you or as a result?
2- whar did you “select all”? are you referring to the visibility of the layers?
Sorry for my ignorance, but I can’t succeed.
And: is it something executable by the user manually or at final step inside the gimp filter?

Forgot: I use GIMP 2.10.32 by samj, if this is relevant

hhhm, I guess I understood:

  • select EACH layer one at a time
  • so select the first layer below the one with the frame (unvisible)
  • click on its content
  • click on the alignment tool options (the user sees the movements)
  • remove visibility to this layer and go to the next layer
  • repeat
    Is this the procedure?

This layer behavior applies not only to the [Blur] frame, but to all G’mic filters that change (enlarge) the layer size as a result.
I use (in plugins) the workaround shown by PixLab (I add 2 lines of code in plugin to center all layers).

	for layer in image.layers:		
		pdb.gimp_layer_set_offsets(layer, (pdb.gimp_image_width(image)-pdb.gimp_drawable_width(layer))/2, (pdb.gimp_image_height(image)-pdb.gimp_drawable_height(layer))/2)

Overall, though, I also consider this a minor flaw of the G’MIC.

Edit 08.08.2023
For those interested, I’ve added the CENTERED function to Switches Layer.py GimpScripts: Switches Layer

Centered Layers

1 Like

Thanks MrQ.
I used the “gimp_layer_translate” in my wip filter, now I moved to your solution.
Glad you also consider this behaviour a flaw: I guess it is so particularly for the frame because -to be complete- the solution should take care also of the type of frame generated (ellipse or square or…) and cut what superfluous when frame is not a simple rectangle. Temporarily I do that, but it seems that G’MIC has a different way (different from Gimp) of creating curves in round-rectangular formats, so my cleaning step is approximate.

Hi Diego, a video?

When you see on the video that I am selecting the layers it’s with the Alignment tool, so yes as a “user” interface I do need to put as non visible the layer on top (from G’MIC), if not it will select it instead (I do it also in the video), look at the 4 little white square after drawing the area of the selection, they are showing the area of the different layers selected.

Align tool >4.2. Align

I don’t know if in python you need to make non visible (sorry i’m no programmer), but on the user interface we select the smaller layers and we need to make the top one (bigger) NOT visible to be able to access all the smaller below-underneath

I also found this about align with python

script-fu access to alignment tool? • GIMP Chat (Ofnuts speaks about python)
Gimp, python-fu: Align layer with respect to background layer in image - Stack Overflow

I hope it can help

1 Like

No, the Align tool has this capacity to select → act like the selection tool (kind of), the square-rectangle I am drawing on the video will select ALL layers that have a size inferior (or equal) of the square-rectangle I did draw and are directly below or underneath.

I would say, that the selection made with the align tool is an area where all layers of which the size is inferior or equal to that area and directly underneath-below will be selected

I hope my “explanations” are understandable (not sure I would understand myself :grin: )

Thanks PL, as you have seen looking at the other answers, the problem -*inside the filter-*can be solved using MrQ simple “for…”.
So the user is not obliged to do anything.

1 Like