Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can python access gegl tools?
#1
I'm no python... at all.
I would like to know if we can write something in python using the "Filters/Map/Recursive transform..." tool, if so what would it be like?
Any reference to this tool using python would be wonderful
Reply
#2
You could start here: https://www.gimp-forum.net/Thread-Script...operations
and here: http://gimpchat.com/viewtopic.php?f=9&t=18040&start=10
Mostly script-fu but there is some python at the end.

There will also be some code in here: https://www.gimpscripts.net/2021/10/mrq-...s-rpl.html
Reply
#3
(11-10-2021, 06:49 PM)rich2005 Wrote: You could start here: https://www.gimp-forum.net/Thread-Script...operations
and here: http://gimpchat.com/viewtopic.php?f=9&t=18040&start=10
Mostly script-fu but there is some python at the end.

There will also be some code in here: https://www.gimpscripts.net/2021/10/mrq-...s-rpl.html

Sorry for late answer, I forgot that I did post here.

I am searching for something more or less like
Code:
pdb.gimp_layer_recursive_transform(img, layer, parameter 1, 2, 3, 4, 5, and so on)
But I might be completely wrong
anyway thanks a lot Rich
Reply
#4
A couple of plugins that you can look at Wink

First the fu-python-high-pass.py  This is the type that you want. It registers in the database as gegl-high-pass with parameters. Too complicated for me to adapt to recursive-transform.

The second gegl-command.py is an example of slotting a gegl function into a plugin written for the purpose.

Find information about the recursive transform variables: https://gegl.org/operations/gegl-recursi...sform.html
You can  get some gegl settings if you export the saved values to a file. Looks like this:

Code:
https://gegl.org/operations/gegl-recursive-transform.html
# GIMP 'Recursive Transform' settings

(time 0)
(transform "matrix(0.99331105831873456,0,0,0,0.95348834991455078,0,4,0,1)")
(first-iteration 3)
(iterations 5)
(fade-color (color-rgba 0 0 0 0))
(fade-opacity 1)
(paste-below no)
(sampler-type linear)

# end of 'Recursive Transform' settings

...and rewritten as a string 

Code:
gegl_graph_string="recursive-transform transform='matrix(0.99331105831873456,0,0,0,0.95348834991455078,0,4,0,1)' first-iteration=3 iterations=5 fade-color=rgba(0.0,0.0,0.0,0.10)  fade-opacity=1 paste-below=1 sampler-type=linear"

and that goes into the gegl-command.py in line 53  The plugin registers in the tools menu. 

Apart from that, I do not know,best of luck Wink

Edit: Does not work in Windows , such is life, probably needs the Windows GEGL binary installing.

Silly-me, It does work, I was not using a transparent layer.


Attached Files
.zip   gegl-examples.zip (Size: 2.95 KB / Downloads: 135)
Reply
#5
(11-23-2021, 04:03 PM)rich2005 Wrote: A couple of plugins that you can look at Wink

First the fu-python-high-pass.py  This is the type that you want. It registers in the database as gegl-high-pass with parameters. Too complicated for me to adapt to recursive-transform.

The second gegl-command.py is an example of slotting a gegl function into a plugin written for the purpose.

Find information about the recursive transform variables: https://gegl.org/operations/gegl-recursi...sform.html
You can  get some gegl settings if you export the saved values to a file. Looks like this:

Code:
https://gegl.org/operations/gegl-recursive-transform.html
# GIMP 'Recursive Transform' settings

(time 0)
(transform "matrix(0.99331105831873456,0,0,0,0.95348834991455078,0,4,0,1)")
(first-iteration 3)
(iterations 5)
(fade-color (color-rgba 0 0 0 0))
(fade-opacity 1)
(paste-below no)
(sampler-type linear)

# end of 'Recursive Transform' settings

...and rewritten as a string 

Code:
gegl_graph_string="recursive-transform transform='matrix(0.99331105831873456,0,0,0,0.95348834991455078,0,4,0,1)' first-iteration=3 iterations=5 fade-color=rgba(0.0,0.0,0.0,0.10)  fade-opacity=1 paste-below=1 sampler-type=linear"

and that goes into the gegl-command.py in line 53  The plugin registers in the tools menu. 

Apart from that, I do not know,best of luck Wink

Edit: Does not work in Windows , such is life, probably needs the Windows GEGL binary installing.

Silly-me, It does work, I was not using a transparent layer.

Wow, invaluable link and examples!
Thank you so much Rich
Reply


Forum Jump: