Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Re: Scripting GEGL functions

Mon Aug 24, 2020 10:28 pm

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
Code:
"color", gegl.gegl_color_new (b "# 700")
,
does not help.

Re: Scripting GEGL functions

Tue Aug 25, 2020 12:12 am

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 !

Re: Scripting GEGL functions

Tue Aug 25, 2020 2:22 am

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


I recommend reading the information in the GEGL Graph dialog:
Untitled1.png
Untitled1.png (38.27 KiB) Viewed 5365 times


Kevin

Re: Scripting GEGL functions

Sun Sep 13, 2020 3:02 pm

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

Re: Scripting GEGL functions

Sun Sep 13, 2020 5:27 pm

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).

Re: Scripting GEGL functions

Tue Sep 15, 2020 12:15 pm

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.

Re: Scripting GEGL functions

Tue Sep 15, 2020 12:33 pm

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!

Re: Scripting GEGL functions

Tue Sep 15, 2020 1:22 pm

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).

Re: Scripting GEGL functions

Tue Sep 15, 2020 1:59 pm

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?

Re: Scripting GEGL functions

Tue Sep 15, 2020 2:17 pm

I answer to myself: YES !
Code:
#!/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()

Re: Scripting GEGL functions

Wed May 19, 2021 12:50 pm

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.

Re: Scripting GEGL functions

Thu May 20, 2021 3:16 am

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

Re: Scripting GEGL functions

Thu May 20, 2021 3:38 pm

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 :)

Re: Scripting GEGL functions

Tue May 25, 2021 9:41 am

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.

Re: Scripting GEGL functions

Tue May 25, 2021 12:54 pm

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.

gegl.jpg
gegl.jpg (161.44 KiB) Viewed 4562 times

Re: Scripting GEGL functions

Tue May 25, 2021 1:01 pm

https://gegl.org/operations/

Image

Re: Scripting GEGL functions

Tue May 25, 2021 1:30 pm

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).

Re: Scripting GEGL functions

Wed Nov 24, 2021 11:10 pm

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?

Re: Scripting GEGL functions

Thu Nov 25, 2021 10:15 am

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

Re: Scripting GEGL functions

Thu Nov 25, 2021 3:21 pm

contrast_,
That was a informative video. Thanks.
Post a reply