GIMP Chat
http://gimpchat.com/

Scripting GEGL functions
http://gimpchat.com/viewtopic.php?f=9&t=18040
Page 2 of 3

Author:  MareroQ [ Mon Aug 24, 2020 10:28 pm ]
Post subject:  Re: Scripting GEGL functions

Hi Kevin.

Great solutions. :tyspin
Do you have a working example when it comes to choosing a color?
I am doing something very wrong because a tip from Massimo Valentini
"color", gegl.gegl_color_new (b "# 700")
,
does not help.

Author:  dinasset [ Tue Aug 25, 2020 12:12 am ]
Post subject:  Re: Scripting GEGL functions

Started using the method kindly provided by Kevin for using GEGL.
Look here: viewtopic.php?f=11&t=18691&start=30
I like much more GEGL c2g !
Thanks again Kevin !

Author:  paynekj [ Tue Aug 25, 2020 2:22 am ]
Post subject:  Re: Scripting GEGL functions

to specify a color you can use rgb(r,g,b) or rgba(r,g,b,a):
Attachment:
Untitled.png
Untitled.png [ 86.44 KiB | Viewed 5372 times ]


I recommend reading the information in the GEGL Graph dialog:
Attachment:
Untitled1.png
Untitled1.png [ 38.27 KiB | Viewed 5367 times ]


Kevin

Author:  MareroQ [ Sun Sep 13, 2020 3:02 pm ]
Post subject:  Re: Scripting GEGL functions

A very good solution is presented on the website:
Samj Créations
https://samjcreations.blogspot.com/2020 ... -tres.html

Image

If you want to use gegl_list_all (for me the slashes must be in the opposite direction) this is in the attachment.

@Kevin
Late thanks for the information provided

Attachments:
gegl_list_all.zip [1.5 KiB]
Downloaded 177 times

Author:  MareroQ [ Sun Sep 13, 2020 5:27 pm ]
Post subject:  Re: Scripting GEGL functions

First tests....
The interesting thing about a plugin is that for it to work, you don't have to enter all its parameters - just the ones you want to change - and the rest are accepted by default.

Image

Image

If You are interested in parameter names and their range, you can find them in * .c files (in the appendix they come from Gegl Version: 0.4.24 - gegl\operations common).

Attachments:
Gegl-operations-common.zip [315.09 KiB]
Downloaded 175 times

Author:  MareroQ [ Tue Sep 15, 2020 12:15 pm ]
Post subject:  Re: Scripting GEGL functions

I adapted the plug (a bit) to my needs:
Ver.2 - add: 80 operations, open the result as a layer, Preset in Notepad (separate entry in the menu: Filters/GEGL command & preset ...) with a list of operations (and to save by pasting versions of interesting settings).

Image
Image

Since the gegl.exe executable (Windows) is available in portable versions of Gimp from Samj Creation, but not in the official version of gimp.org - it is also included.
Why there are two fields for custom operations - to compare how changing a specific parameter affects the result (and keep the previous setting).

ps. Samj writes "Gegl_command_line.py" will likely be replaced by a C filter after Python 2 is abandoned.

Attachments:
Mosaic + apply-lens.png
Mosaic + apply-lens.png [ 89.76 KiB | Viewed 4661 times ]
Gegl_command_line V.2.zip [324.61 KiB]
Downloaded 192 times

Author:  dinasset [ Tue Sep 15, 2020 12:33 pm ]
Post subject:  Re: Scripting GEGL functions

Is this version callable from a main .py filter?
Does it return the result to the caller?
If yes, could you write a very small example as a guide?
Thanks!

Author:  MareroQ [ Tue Sep 15, 2020 1:22 pm ]
Post subject:  Re: Scripting GEGL functions

Hi Diego.

Usage is simple: :yes
- open any RGB photo *;
- run the plugin from the menu: Filters / GEGL command line ...;
- select the type of operation (80 standard +2 non-standard=Custom);
- select ExportType (PNG or JPEG);
- select how to open image (as a new layers or a new image);
- new images processed by Gegl are saved in the bin folder (and overwritten with);
- when you run ( Filters / GEGL & preset.txt command...) a document will open with a list of all operations and a link where you can find additional ones informations;
- in this I also save interesting settings for Custom;
- the record can be pasted into the plugin Command line GEGL (in Custom-1 or Custom-2)
- 80 operation is run without aditional parameters with default values ​​(there are many more operations in the documentation - but require additional parameters).

Author:  dinasset [ Tue Sep 15, 2020 1:59 pm ]
Post subject:  Re: Scripting GEGL functions

What you detailed is how to use it ONLINE
(2.point "run the plugin from the menu: Filters / GEGL command line ...")

I would like to run one filter written by me and -when a gegl operation is required- write something like
.....
outlayer=pdb.python_fu_gegl_command_line (inImage, inlayer, cmd string)
...
then do whatever next I need using outlayer produced by the gegl command line

Is it possible?

Author:  dinasset [ Tue Sep 15, 2020 2:17 pm ]
Post subject:  Re: Scripting GEGL functions

I answer to myself: YES !
#!/usr/bin/env python
from gimpfu import *
def TestGEGLsamj(inImage, inLayer):

    gimp.message ("Hello!")
   
    wrklayer=inLayer.copy()
    inImage.add_layer (wrklayer,0)
    pdb.python_fu_gegl_command_line (inImage, wrklayer, 2, "blabla", "blabla", 0, 0)    # 2= alien map
    outlayer = inImage.layers[0]
   
    gimp.message ("Done!")
    # ...... do what you like on outlayer
   
   
    return

register(
    "TestGEGLsamj",
    "TestGEGLsamj",
    "TestGEGLsamj.",
    "Diego",
    "Diego Nassetti ",
    "2020",
    "TestGEGLsamj",
    "RGB*",
    [
        (PF_IMAGE, "image", "Input image", None),
        (PF_DRAWABLE, "drawable", "Input drawable", None),
        ],
    [
        (PF_IMAGE, "outimage", "Output image", None),
        ],
    TestGEGLsamj,
    menu="<Image>/Diego/Test",
    )

main()


Author:  cli345 [ Wed May 19, 2021 12:50 pm ]
Post subject:  Re: Scripting GEGL functions

Hello :)

Here is the paynekj's code converted into a "gegl_command.py" plug-in.
It does not show in any menu, but it enables to code "pdb.python_gegl(theImage, theDrawable, theGeglCommand)".
It's tested on Linux but not on Windows.

EDIT:
That's a (near-)duplicate of gimp-forum.net.
(The file was "fu-python-gegl_ops_test.py". It enabled to code "pdb.gegl_gegl(theDrawable, theGeglCommand)".)
Regardless of the duplication, I suggest to keep "gegl_command.py" that is made up of paynekj's simpler version.
( :oops: Sorry, for the mess.)

==> "gegl_command.py" has to be put in the "plug-ins" directory.

Attachments:
gegl_command.zip [934 Bytes]
Downloaded 333 times

Author:  Issabella [ Thu May 20, 2021 3:16 am ]
Post subject:  Re: Scripting GEGL functions

cli345, thanks again for your nice plug-ins.
I have windows and it works great in neontext. :tyspin :hi5

Attachments:
Works_in_Windows.jpg
Works_in_Windows.jpg [ 42.62 KiB | Viewed 4965 times ]

Author:  cli345 [ Thu May 20, 2021 3:38 pm ]
Post subject:  Re: Scripting GEGL functions

Thanks instead to paynekj :tyspin (It isn't my plug-in, I only isolated his code into a file)

Thank you Issabella for your feedback :)

Author:  dinasset [ Tue May 25, 2021 9:41 am ]
Post subject:  Re: Scripting GEGL functions

Is there an update of the Gegl-operations-common file posted at #25?
Some operations are missing.
Sorry to ask but I'm unable to find an update by googling, I suppose there is a recent more complete list of the c functions, where to look to see the required parameters.
Thanks.

Author:  rich2005 [ Tue May 25, 2021 12:54 pm ]
Post subject:  Re: Scripting GEGL functions

dinasset wrote:
Is there an update of the Gegl-operations-common file posted at #25?
Some operations are missing.
Sorry to ask but I'm unable to find an update by googling, I suppose there is a recent more complete list of the c functions, where to look to see the required parameters.
Thanks.


For what it is worth the GEGL page is back on line. https://gegl.org/operations/ That takes you to individual functions with descriptions and syntax.

For Windows ;)

The samj 2.10.24 no longer includes the file gegl.exe but it is there in the zip on post#25 I works in both samj and regular Gimp 2.10.24
It is worth reading the samj GEGL post on this page https://samjcreations.blogspot.com/2020 ... -tres.html

Example screenshot for functions listing ( --list-all ) and for an individual operation. ( --info gegl:xxxxx) I make 250 operations.

Attachment:
gegl.jpg
gegl.jpg [ 161.44 KiB | Viewed 4564 times ]

Author:  MareroQ [ Tue May 25, 2021 1:01 pm ]
Post subject:  Re: Scripting GEGL functions

https://gegl.org/operations/

Image

Author:  dinasset [ Tue May 25, 2021 1:30 pm ]
Post subject:  Re: Scripting GEGL functions

Thanks a lot, I will check whether I can find what needed.
In any of my last scripts there are some gegl operations (sometimes I didn't find what I was looking for).

Author:  contrast_ [ Wed Nov 24, 2021 11:10 pm ]
Post subject:  Re: Scripting GEGL functions

Hey guys. A command like

gegl:layer src=/home/contrast/Pictures/LinkedLayers/share.png

is literally the closest thing to having to a shared shared layer system like photoshop

Image I made a GEGL Graph preset of it but I was wondering if anyone had a better idea to implement this?

Author:  contrast_ [ Thu Nov 25, 2021 10:15 am ]
Post subject:  Re: Scripting GEGL functions

I would like to show GEGL Graph's ability to live syntax edit text style effects. I wish more Gimp users knew about this as I have been doing this since June 2021 and no longer have to spam multiple drop shadow filters.

https://streamable.com/4p9c1z

Author:  gasMask [ Thu Nov 25, 2021 3:21 pm ]
Post subject:  Re: Scripting GEGL functions

contrast_,
That was a informative video. Thanks.

Page 2 of 3 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/