RSS/Atom feed Twitter
Site is read-only, email is disabled

pathon-scripts with GEGL?

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

7 of 7 messages available
Toggle history

Please log in to manage your subscriptions.

pathon-scripts with GEGL? Gunold Brunbauer 28 Nov 10:38
  pathon-scripts with GEGL? Joao S. O. Bueno 28 Nov 14:46
   pathon-scripts with GEGL? Joao S. O. Bueno 28 Nov 15:50
    pathon-scripts with GEGL? Daniel Sabo 29 Nov 07:31
     pathon-scripts with GEGL? Joao S. O. Bueno 29 Nov 10:30
      pathon-scripts with GEGL? Daniel Sabo 29 Nov 15:32
       pathon-scripts with GEGL? Joao S. O. Bueno 29 Nov 15:52
Gunold Brunbauer
2013-11-28 10:38:05 UTC (over 10 years ago)

pathon-scripts with GEGL?

I want to get used to python-scripting in gimp. Therefor I want to study some scripts. Can anybody recommend me some scripts which are easy to understand and use GEGL?

Thank you in advance Gunold
www.bilderstroeme.de

Joao S. O. Bueno
2013-11-28 14:46:49 UTC (over 10 years ago)

pathon-scripts with GEGL?

There are currently no, that I know, scripts that use both GIMP-Python and PyGegl - if there are, tehre is no integration between both.

Python + GEGL should work fine though Pygobject introspection - but currently there is no straightforward way for retrieving a GEGL Buffer for a GIMP drawable, operate on it, and putting it back on GIMP. - We certainly should think about providing this functionality for GIMP though.

On 28 November 2013 08:38, Gunold Brunbauer wrote:

I want to get used to python-scripting in gimp. Therefor I want to study some scripts. Can anybody recommend me some scripts which are easy to understand and use GEGL?

Thank you in advance Gunold
www.bilderstroeme.de
_______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp- developer-list

Joao S. O. Bueno
2013-11-28 15:50:10 UTC (over 10 years ago)

pathon-scripts with GEGL?

Here -
I've put together this proof-of-concept snippet using Python + Gobject introspection + GEGL -

While both GEGL, Gobject and Python are higly introspective tecnologies, leaving them connecting all by themselves as is the current status of Python + GEGL leave space for a lot of improvement -
(the Python introspection cannot introspect into GEGL stuff, but for indirectly calling the GEGL API,
and setting proeprties on GEGL nodes has to be done by the C API as well, despite
Python's (and gobjects's) numerous features for property handling)

http://pastebin.com/aiZ4Zv87

js -> wrote:

There are currently no, that I know, scripts that use both GIMP-Python and PyGegl - if there are, tehre is no integration between both.

Python + GEGL should work fine though Pygobject introspection - but currently there is no straightforward way for retrieving a GEGL Buffer for a GIMP drawable, operate on it, and putting it back on GIMP. - We certainly should think about providing this functionality for GIMP though.

On 28 November 2013 08:38, Gunold Brunbauer wrote:

I want to get used to python-scripting in gimp. Therefor I want to study some scripts. Can anybody recommend me some scripts which are easy to understand and use GEGL?

Thank you in advance Gunold
www.bilderstroeme.de
_______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp- developer-list

Daniel Sabo
2013-11-29 07:31:16 UTC (over 10 years ago)

pathon-scripts with GEGL?

Assuming were talking about gegl-master here, what are you unable to do via introspection? The introspection bindings have full coverage of the GEGL API. Mainipulating pixels directly (rather than though operations) involves more copying in Python than is C because Python has no concept of mutable buffers. It would be possible to expose things via ctypes or numpy, but that requires writing a CPython module and will probably not be part of GEGL itself.

To get/set raw pixels from from a gegl buffer use Buffer.get(...) and Buffer.set(...).

Joao S. O. Bueno
2013-11-29 10:30:39 UTC (over 10 years ago)

pathon-scripts with GEGL?

I've writing started such CPython bindings yesterday - in time we should expose the buffers in a proper way.

https://github.com/jsbueno/python-gegl

What is difficult to do via pygobject bindings is to make use of GEGL itself - the linked example file of yesterday sepeaks for itself.

While GEGL in C has provisions for function calls to be made emulating named parameters from Python, for, for example, setting various properties at once, I didn't get that to work from Python. Moreover, a Python user wll rather do: pngnode.path = "myfile.png" - rather than "pngnode.set_property("path", "myfile.png") as is required by the automated bindings.

Daniel - if you are into it, I've hit a but at my first steps: when using GParamSpec objects (via an operation_list_properties call) I had the Python interpreter segfaulting (it happens on trying to introspect the GParamSpec objects with "dir", but in other occasions I could not isolate as well)

js
-> wrote:

Assuming were talking about gegl-master here, what are you unable to do via introspection? The introspection bindings have full coverage of the GEGL API. Mainipulating pixels directly (rather than though operations) involves more copying in Python than is C because Python has no concept of mutable buffers. It would be possible to expose things via ctypes or numpy, but that requires writing a CPython module and will probably not be part of GEGL itself.

To get/set raw pixels from from a gegl buffer use Buffer.get(...) and Buffer.set(...).

Daniel Sabo
2013-11-29 15:32:34 UTC (over 10 years ago)

pathon-scripts with GEGL?

$ python
Python 2.7.3 (default, Jul 24 2012, 11:41:40) [GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2

from gi.repository import Gegl
Gegl.init([])[]
params = Gegl.operation_list_properties("gegl:png-load")

(python:21947): GEGL-gegl-operations.c-WARNING **: Adding GeglChantinvert-linear_c shadows GeglChantinvert_c for operation gegl:invert
/usr/lib64/python2.7/site-packages/gi/types.py:43: Warning: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs) /usr/lib64/python2.7/site-packages/gi/types.py:43: Warning: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs)

** (python:21947): CRITICAL **: pygobject_register_wrapper: assertion 'PyObject_TypeCheck(self, &PyGObject_Type)' failed

dir(params[0])

Segmentation fault (core dumped)
$

There are bugs is older versions of pygobject related to dir() and tab completion in the interactive interpreter, I suspect you're hitting one of those.

I can't replicate this crash when using pygobject 2.28.6 and gobject-introspection 1.38.0, but I have seen similar issues on Ubuntu 12.04 which uses gobject-introspection 1.32.0.

The warning about "GeglChantinvert-linear_c shadows GeglChantinvert_c" means you have old files in your $PREFIX/lib/gegl-0.3/ directory you should probably delete.

Joao S. O. Bueno
2013-11-29 15:52:30 UTC (over 10 years ago)

pathon-scripts with GEGL?

Ok - if it is working in current stable versions, I am fine them (yesterday I falied to build pygobject 2.28.6 on a first try, in a clean prefix., will try harder later on).

On 29 November 2013 13:32, Daniel Sabo wrote:

$ python
Python 2.7.3 (default, Jul 24 2012, 11:41:40) [GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2

from gi.repository import Gegl
Gegl.init([])[]
params = Gegl.operation_list_properties("gegl:png-load")

(python:21947): GEGL-gegl-operations.c-WARNING **: Adding GeglChantinvert-linear_c shadows GeglChantinvert_c for operation gegl:invert
/usr/lib64/python2.7/site-packages/gi/types.py:43: Warning: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs) /usr/lib64/python2.7/site-packages/gi/types.py:43: Warning: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed return info.invoke(*args, **kwargs)

** (python:21947): CRITICAL **: pygobject_register_wrapper: assertion 'PyObject_TypeCheck(self, &PyGObject_Type)' failed

dir(params[0])

Segmentation fault (core dumped)
$

There are bugs is older versions of pygobject related to dir() and tab completion in the interactive interpreter, I suspect you're hitting one of those.

I can't replicate this crash when using pygobject 2.28.6 and gobject-introspection 1.38.0, but I have seen similar issues on Ubuntu 12.04 which uses gobject-introspection 1.32.0.

The warning about "GeglChantinvert-linear_c shadows GeglChantinvert_c" means you have old files in your $PREFIX/lib/gegl-0.3/ directory you should probably delete.