Switch to full style
Post all Gimp tutorials, tips and how-to's here
Post a reply

Learn GEGL graph

Wed Jun 23, 2021 10:29 am

Hello, :)

Here is a tutorial to learn the "GEGL graph" filter.
EDIT: For the motivations, you can read this thread first.
EDIT (thanks to rich2005): Warning: this filter doesn't make a single effect, but it enables you to program almost all effects and combine them.

1) First steps:

  • Open an image
  • Go to "Filters->Generic->GEGL graph
    menu.jpg
    menu.jpg (42.83 KiB) Viewed 18322 times
  • Click the "pipeline" box
    pipeline.jpg
    pipeline.jpg (53.31 KiB) Viewed 18322 times
  • Hit "ctrl-a" and the "delete" key
    emptyPipeline.jpg
    emptyPipeline.jpg (31.1 KiB) Viewed 18322 times
  • Write anything (for example, "sdfg")
  • ...to be continued in the next post...

Re: Learn GEGL graph

Wed Jun 23, 2021 10:39 am

  • Look at below the "pipeline" box
    info.jpg
    info.jpg (39.25 KiB) Viewed 18324 times
    This part will be the most useful one (It's the info zone)
    but, for now, it's not very useful : it just indicate that the "sdfg" operation doesn't exist
    .
  • Delete "sdfg" and write "e"
    info2.jpg
    info2.jpg (55.76 KiB) Viewed 18324 times
    Now, it's more useful, it offers suggestions
    .
  • We choose "gegl:edge". Note: you don't need to write "gegl:"
    So, continue to write to obtain "edge" and look at the info zone for each character you type
    info3.jpg
    info3.jpg (100.13 KiB) Viewed 18324 times
    The info zone has disappeared and the "edge" effect is done
    .
  • Congratulations, you have written your first GEGL graph.

Note: Some operations don't belong to GEGL. For these ones, you have to prefix the operation with "gimp:" (for example, "gimp:desaturate").

Have fun!

To be continued...

Re: Learn GEGL graph

Thu Jun 24, 2021 9:56 am

2) How to add parameters:

You wish to add parameters but you don't know which exist :? : no problem ;).
  • After "edge" write a blank space and write "aa=" (without any spaces between "aa" and "=").
    param1.jpg
    param1.jpg (42.31 KiB) Viewed 18241 times
    The info zone indicates all possible parameters (It calls them "properties")
    .
  • We choose "algorithm". So replace "aa" by "algorithm"
    param2.jpg
    param2.jpg (43.18 KiB) Viewed 18241 times
    The info zone indicates all possible value for the "algorithm" parameter
    .
  • We choose "differential". So, just after "=", write "differential" (without any spaces between "=" and "differential").
    param3.jpg
    param3.jpg (34.14 KiB) Viewed 18241 times
    The info zone has disappeared and the "edge algorithm=differential" effect is done
.
CAUTION: "id=blahblah" and "ref=blahblah" look like parameters and are written like parameters but they are NOT, they are special operations
(We will see later their use).
(If you are very curious and cannot wait, "id=blahblah" is "save" and "ref=blahblah" is "retrieve")

Have fun!

To be continued...

Re: Learn GEGL graph

Thu Jun 24, 2021 8:35 pm

I like the way you're teaching, by showing that the cat can walk on our keyboard and the result will be that we won't break anything but get help, is very nice :bigthup

Re: Learn GEGL graph

Fri Jun 25, 2021 1:04 am

Thanks cli345 for taking the time to put this together. :yr
It's been added to our tutorial index.

Re: Learn GEGL graph

Fri Jun 25, 2021 5:28 am

Thanks for your valuable feedback! :tyspin

3) How to chain multiple effects:

You simply list all the effects each in one line like this:
chain.jpg
chain.jpg (36.41 KiB) Viewed 18186 times
Note: You don't have to put them into multiple lines. You may put them into a single line but separated by spaces (It's just less clear ;)).
Note: We will see later that it's possible to get all intermediate stages back.

Have fun!

To be continued...

Re: Learn GEGL graph

Sat Jun 26, 2021 1:42 am

Thanks for doing this tutorial. I find it very helpful.

Re: Learn GEGL graph

Sat Jun 26, 2021 9:49 am

Thanks, nelo, for your valuable feedback! :tyspin

4) How to save and retrieve any intermediate stage:

To save an intermediate stage, simply add the special operation "id=chosenName" where the intermediate stage occurs.
For example:
intermediate1.jpg
intermediate1.jpg (33.51 KiB) Viewed 18103 times
To retrieve an intermediate stage, simply add the special operation "ref=nameOfStageToRetrieve" where you want it to come back.
For example:
intermediate2.jpg
intermediate2.jpg (34.22 KiB) Viewed 18103 times
This is a crazy example (since I discard "invert-gamma" result :shock:), but we will see useful examples later.

Have fun!

To be continued...

Re: Learn GEGL graph

Sun Jun 27, 2021 12:07 pm

I'm curious as to what this plugin does.

Re: Learn GEGL graph

Mon Jun 28, 2021 4:49 am

Excellent!
Thanks cli345 (out of curiosity, does cli in your nickname stand for "command line interface"?)

Re: Learn GEGL graph

Mon Jun 28, 2021 5:49 am

PixLab wrote:Excellent!
Thanks cli345 (out of curiosity, does cli in your nickname stand for "command line interface"?)

Maybe, but I'm guessing it's derived from Claude and the French city of Lyon.
This looks interesting :bigthup

Re: Learn GEGL graph

Mon Jun 28, 2021 10:06 am

Thank you, mackenzieh, for your question.
Rich2005 has answered here (Thanks, rich2005).

This diagram is aimed to explain my last (crazy) example:
pipelineExplain1b.jpg
pipelineExplain1b.jpg (18.08 KiB) Viewed 10811 times

(EDIT: I've changed the diagram)

Re: Learn GEGL graph

Mon Jun 28, 2021 6:40 pm

cli345 wrote:Thank you, mackenzieh, for your question.
Rich2005 has answered here (Thanks, rich2005).

This diagram is aimed to explain my last (crazy) example:
pipelineExplain1.jpg


I think I get it now. :)

Re: Learn GEGL graph

Tue Jun 29, 2021 10:13 am

5) How to combine multiple effects:

Some operations (for example, "multiply", "subtract") enable you to combine two results.
These operations accept a special parameter : "aux=[ ... ]" (No space around "=", a mandatory space after "[" and before "]").

For example, one of these operations is "subtract" (this operation does the same job as "subtract" layer mode).
In "GEGL graph", write:
Code:
id=myStart

gaussian-blur
id=myBlur

ref=myStart
subtract aux=[ ref=myBlur ]

Notes:
  • (When you've typed "aux=", the info zone says "aux" parameter doesn't exist (It's not true). But, when you've typed "[", the error disappears.)
  • This GEGL graph does the same effect as this process:
    • duplicate the layer
    • apply a gaussian blur onto the upper layer
    • set the mode of upper layer to "subtract"
    • do "merge down" on the upper layer
  • ("aux=[ blahblah ]" seems always accepted but, for most operations, it does not change anything.)
  • This GEGL graph can be compacted to "id=myStart subtract aux=[ ref=myStart gaussian-blur ]"

Have fun!

To be continued...

Re: Learn GEGL graph

Tue Jun 29, 2021 3:20 pm

I was just scratching my blockhead if it's possible to change layer modes somehow, having workflows that include stress, fattal and mantiuk filters with changed layer modes. This is fantastic information, now I can convert some of them into GEGL Graph one-clickers.
Thank you Claude. :bigthup

Re: Learn GEGL graph

Wed Jun 30, 2021 2:23 am

great stuff, thanks!

Re: Learn GEGL graph

Thu Jul 01, 2021 11:41 am

Thanks, for your feedback!

This diagram is aimed to explain my last example:
pipelineExplain2.jpg
pipelineExplain2.jpg (26.77 KiB) Viewed 10734 times

Re: Learn GEGL graph

Fri Jul 02, 2021 8:40 am

The last diagram can be summarized by:
pipelineExplain2b.jpg
pipelineExplain2b.jpg (13.06 KiB) Viewed 10695 times

Re: Learn GEGL graph

Wed Jul 07, 2021 9:39 am

6) Practice

Code this "GEGL graph":
practice1.jpg
practice1.jpg (38.27 KiB) Viewed 10615 times

Here are loose fragments for easy copy-pastes:
Code:
noise-reduction
bilateral-filter edge-preservation=100 blur-radius=12
difference-of-gaussians radius1=0.66 radius2=0.22
levels in-low=0.001 in-high=0.01
gimp:desaturate mode=value
invert
antialias
hue-chroma chroma=20 lightness=10
multiply


Warning: At each letter typed, the whole effect is recomputed. So, it's better to write in a text editor and copy-paste onto the "GEGL graph" window.

Have fun!

To be continued...

Re: Learn GEGL graph

Wed Jul 07, 2021 1:07 pm

cli345 wrote:Warning: At each letter typed, the whole effect is recomputed. So, it's better to write in a text editor and copy-paste onto the "GEGL graph" window.
Have fun!
To be continued...

Good hint, I disable preview when testing longer chain of effects and use a small image.
Few times when editing a longer chain somewhere in between, it got stuck and I had to click the GEGL Graph exit button which resulted in crash.

Practice result

GEGL-Practice.png
GEGL-Practice.png (445.82 KiB) Viewed 10601 times
Post a reply