GIMP Chat http://gimpchat.com/ |
|
Scripting GEGL functions http://gimpchat.com/viewtopic.php?f=9&t=18040 |
Page 1 of 3 |
Author: | paynekj [ Fri Feb 21, 2020 10:29 am ] |
Post subject: | Scripting GEGL functions |
Attachment: Untitled.png [ 24.6 KiB | Viewed 9878 times ] Where you see the G in the menus it means that it's a GEGL function and as yet the developers have not implemented any way to call GEGL functions from within scripts. To find the ID of a layer you would get the list of layer-ids and check each one to see if the layer name matches the name you want to find. Kevin PS. You are advised to use Python instead of Script-Fu, especially if you have any programming experience already, purely for ease of use. |
Author: | dinasset [ Fri Feb 21, 2020 11:37 pm ] |
Post subject: | Re: Questions about Script-Fu |
Ya, it's a real pain that after so much time developers did not update pdb to access Gegl functions. Practically all scripters write their filters as if Gimp were still at version 2.8 |
Author: | MareroQ [ Sat Feb 22, 2020 2:39 am ] |
Post subject: | Re: Questions about Script-Fu |
Hi Diego. There are many people interested in answering Your question: https://www.gimpusers.com/forums/gimp-d ... -gimp-gegl so after 3 lost years he may ask again if there are any plans to solve this problem? In the next few years? ps. We write in the thread opened by the spammer (deleted) - it does not bother me but it can change the title and department |
Author: | dinasset [ Sat Feb 22, 2020 4:08 am ] |
Post subject: | Re: Questions about Script-Fu |
Maybe some C expert could at least provide a temporary solution, having the same characteristics of the interface to G'mic: - one single interface - each filter being called by a string of parameters comma separated, the first of which being the name of the filter itself followed by all single parameters required by that specific filter |
Author: | paynekj [ Sun Feb 23, 2020 4:31 pm ] |
Post subject: | Re: Questions about Script-Fu |
Apparently you also need to be a Python expert, see the comment by Massimo Valentini https://gitlab.gnome.org/GNOME/gimp/issues/1686 but it does offer the hope that GEGL functions might actually be scriptable. |
Author: | dinasset [ Mon Feb 24, 2020 12:20 am ] |
Post subject: | Re: Questions about Script-Fu |
I had a look into Massimo Valentini's code. My impression - an impression of a very simple gimp python coder, not at all an expert - is that it looks like a c code "dressed" in python, hence "arabic" for me. I think only Ofnuts can really understand it. |
Author: | paynekj [ Mon Feb 24, 2020 7:37 am ] |
Post subject: | Re: Questions about Script-Fu |
It's not all that difficult, most of Massimo's code is loading and starting gegl and doesn't change. To prove a point I did the same for the GEGL Unsharp-Mask, so you should be able to compare the two and see how little changes. The tricky bit is finding the definitions of the parameters. I downloaded the current source code for GEGL and found the C code defining each of the operations (gegl-master/operations/common). In unsharp-mask.c there is the following: Code: Select all property_double (std_dev, _("Radius"), 3.0) So now I knew that there are three parameters and that they are floats. Hope this helps Kevin Edit 2020.08.24: removed the example code as it's the wrong way to do it. |
Author: | dinasset [ Mon Feb 24, 2020 8:23 am ] |
Post subject: | Re: Questions about Script-Fu |
Thanks Kevin. Still I personally don't feel comfortable and I will not try to define my own interfaces to Gegl functions. I wait to get either from the "official" (ill?) gimp the appropriate pdb. entries, or from people like you the unofficial temporary python interfaces. Thanks again. |
Author: | MareroQ [ Mon Feb 24, 2020 8:39 am ] |
Post subject: | Re: Questions about Script-Fu |
Thanks Kevin for the good information. It seems that after one-time "difficult" preparation in python, further use (eg in script-fu) is very easy. It is worth changing the title of the thread (and You - unexpectedly became the author of the thread) for such important and interesting information. Maybe other users will post here their adaptations of subsequent GEGL filters? I would also prefer to wait for official arrangements but I have no patience anymore. ![]() |
Author: | paynekj [ Mon Feb 24, 2020 9:10 am ] |
Post subject: | Re: Scripting GEGL functions |
I've changed the thread title, but I also think it also could be moved into the Scripts and Plugins section |
Author: | MareroQ [ Mon Feb 24, 2020 5:26 pm ] |
Post subject: | Re: Scripting GEGL functions |
@Wallace Can You make this change? Thank You in advance. |
Author: | Wallace [ Tue Feb 25, 2020 1:57 am ] |
Post subject: | Re: Scripting GEGL functions |
paynekj wrote: I've changed the thread title, but I also think it also could be moved into the Scripts and Plugins section ![]() |
Author: | dinasset [ Sat Aug 22, 2020 12:34 am ] |
Post subject: | Re: Scripting GEGL functions |
I noticed that the "desaturating" function in GEGL (Color to Gray) looks to have much more interesting results than the standard non-GEGL one. Would be someone willing to write the "interface" (in python) so that it can be called from a python filter? I think it would be very useful for filter writers... |
Author: | paynekj [ Sat Aug 22, 2020 4:00 am ] |
Post subject: | Re: Scripting GEGL functions |
If you want to try and experiment for yourself take a look over here: https://www.gimp-forum.net/Thread-Scrip ... operations Otherwise I'll try and get to this next week. Kevin |
Author: | dinasset [ Sat Aug 22, 2020 4:21 am ] |
Post subject: | Re: Scripting GEGL functions |
Thank Kevin. Downloaded and had a look inside. It creates an interface to 3 GEGL operations (waterpixel, slic, emboss), isn't it? But I feel myself totally inadequate to add another one, like Color to Gray, to which I'm interested currently. So I will wait for you having time next week to do it; that's a very generous offer. Thanks. |
Author: | paynekj [ Sat Aug 22, 2020 5:18 am ] |
Post subject: | Re: Scripting GEGL functions |
I've obviously not explained myself very well over on GimpForums There's a python script that provides a scriptable interface to GEGL and an example script-fu to show how to use the python created pdb function. Just to show how to do it, the script-fu actions those three GEGL functions in one go. To use the python, you will need to know how to make command/parameter lists in the Filters>>Generic>GEGL Graph filter |
Author: | dinasset [ Sat Aug 22, 2020 5:32 am ] |
Post subject: | Re: Scripting GEGL functions |
...which is very complex. But: does this mean that the one I pointed to (which is already a GEGL filter, Color to Gray) can't be subject to your same manipulation, being the 3 listed above GEGL function and not filters? IIRC somewhere it's said that you need to look into the GEGL filter and indentify the needed parameters before creating properly the python interface. |
Author: | dinasset [ Sat Aug 22, 2020 8:28 am ] |
Post subject: | Re: Scripting GEGL functions |
To be more precise: I have installed "gegl" unsharp mark, both the python pdb interface and the example calling scheme. What I hope it could be done next week is the "same" for the "gegl" Color to Gray. |
Author: | paynekj [ Mon Aug 24, 2020 10:30 am ] |
Post subject: | Re: Scripting GEGL functions |
I'm not going to create a C2G specific script, so try this instead: Attachment: It's the code you need and an example script that does three actions, C2G, Softglow and Wind that illustrate some ways to build the GEGL Graph pipeline. This way you can easily add more GEGL actions to whatever code you are writing. I make no claims that it will work on anything but Windows 10. |
Author: | dinasset [ Mon Aug 24, 2020 11:02 am ] |
Post subject: | Re: Scripting GEGL functions |
Thanks a lot, Kevin |
Page 1 of 3 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |