You are here

Basic GEGL tutorial?

Hi,
I would like to learn how to use gegl within gimp plugins. But I cannot find any such tutorial.

Im not advanced programmer, so it should be very basic tutorial or an example of very simple plugin. Does anything like this exists?

I know there is quite good documentation and explanation of API calls in GEGL, but it presumes that reader knows much more than I know :(

So, is there anything like this?

I too am interested in GEGL and plugins. I am NOT an expert.

GEGL is a library. It can be used independently from GIMP. There is a command line interface (you can execute it from a terminal.)

The main language to use with GEGL is the C programming language. But their are other language bindings: Python and Ruby among others.

GEGL has its own plugins. They are called operations. In GEGL you construct a graph of nodes for an image processing pipe (but not just linear, can be a graph.) Many nodes are operations. When you write a GEGL plugin, you create a new image processing operation. The GEGL roadmap (see http://gegl.org/contribute.html ) discusses the porting of GIMP plugins to GEGL. One thing it says is that it is "easier." This may be true if you are a C programmer. Even so, as you say, there is a steep learning curve.

Another thing is says is that you shouldn't write GIMP plugins anymore, you should write GEGL plugins!

Also, I would just guess that not all GIMP plugins will be ported, just the simpler ones, without a complex user interface, without much user interaction, with only one source layer, and so forth.

Also, for now, a GEGL plugin appears in GIMP under the "GEGL operations" menu. I don't know how the GEGL plugins will be sorted out in the menus (as most GIMP plugins appear in a hierarchical menu tree "Filters".)

http://lightningismyname.blogspot.com/2010/11/new-gegl-operation.html discusses the port of a formerly GIMP plugin to GEGL. Other plugins have been ported from GIMP to GEGL as part of GSOC.

I am interested in writing a GIMP plugin that uses GEGL. A slight difference here: such a plugin would still use the GIMP plugin machinery, but would avail itself of GEGL.

The reason I wanted to do that would be to prototype the future GIMP capability (using GEGL) to chain together different operations and tweak them non-destructively. In other words, what it means for a user, is that you would be able to make adjustments and see the results quickly, without having to undo/redo previous tweaks. Adjustment layers? That is the main point of GEGL (for users.)

I looked at PyGEGL, the Python binding for GEGL. Its in the GEGL distribution. It may not be in its final, production state. I don't think it installs itself as a Python module if you simply build GEGL. Python won't find it unless you fiddle with PYTHONPATH or similar.

Since a GIMP plugin is in a separate process space, a GIMP plugin that uses GEGL doesn't need to go through GIMP to get to GEGL. But the missing piece for me is, given a GIMP drawable, how do you you get that into the source node (the input) of a GEGL graph, and how do you get it out of the sink node (the output) back into a GIMP drawable for GIMP to display?

thanks for your answer to my question - you are the first after 6 months.

I read carefully your post and then also links you posted there. And spend some time thinking about it. I must admit that I dont know where gimp is heading with gegl. For me, current infrastructure of gimp is sufficient with one exemption. It should store data in more then 8 bits. I can even image some dual regime where these two function could coexists:

gimp_pixel_rgn_get_rect() # current one, it gets 8-bit data from core
gimp_pixel_rgn_get_rect24() # new one

All data would be stored in 24 bits and old function gimp_pixel_rgn_get_rect() would became just a wrapper around new one( ...24()). So old plugins would call gimp_pixel_rgn_get_rect() that would call gimp_pixel_rgn_get_rect24(), convert data to 8-bit and pass it to the plugin. Similar procedure would be employed when returning data to the core.

This way new (24-bit) plugins would coexist with old ones (8-bit plugins).

This is from the perspective of plugins, I'm sure there are much more aspects and technical issues against adoption for such solution.

So in short about gegl - it seems to me that I have no use of gegl and for now no interest to learn and work with it.

Did find an article that tells that the line

GeglBuffer *buffer = gimp_drawable_get_buffer (drawable);

returns you a GeglBuffer you can acces to with the standard gegl methods: http://gimpfoo.de/2012/04/17/goat-invasion-in-gimp/
All that now seems to be still missing is an actual Gegl tutorial ;-)

Subscribe to Comments for "Basic GEGL tutorial?"