Re: [Gimp-developer] How to call gimp_export_image() from Pythonplugin



My understanding is that libgimp is for C plugins. Many libgimp functions are in fact calls to PDB functions - see libgimp/gimppainttools_pdb.c for example. The distinction between "high" and "low" level is not the one used to determine what is in the PDB and what is not - despite what you say, there are gimp-drawable-set-pixel and gimp-drawable-get-pixel procs in the PDB.

It seems you are knowledgeable in writing interface code for Python. Why not add gimp_export_image to the available python functions?

-----Original Message----- From: Vladimir Rutsky
Sent: Thursday, June 19, 2014 11:52 PM
To: Ed .
Cc: gimp-developer
Subject: Re: [Gimp-developer] How to call gimp_export_image() from Pythonplugin

On 19.06.2014 22:09, Ed . wrote:
It is not a PDB function, but a libgimp (C) function. Since pygimp can do gimpui stuff (also C functions), there is no conceptual reason why pygimp shouldn't also handle gimpexport (which is where gimp_export_image lives).

Which functions in GIMP goes to PDB, and which stays only in libgimp?

As I understand, libgimp should contain _all_ functionality, that may be
needed for external C plugins. So it's "low-level" library.

PDB functions are designed to be called from scripts for automation and
easer writing custom plugins in Scheme/Python/Perl scripts.
So there mostly should be "high-level" functions, since there is no
point in calling "low-level" operations, like set_pixel(), due to
performance overhead of PDB.

gimp_export_image() is "high-level" function: it does several operations
on image as whole and optionally asks user for some input.
If gimp_export_image() would be available though PDB, it could be called
from any "fu"-script, that can call PDB functions, and there would be no
need to export it specifically in Python, Perl, Ruby, C#...

Correct me if I'm wrong, since I'm new to PDB and GIMP development.


I thought that in Python it was straightforward to access C functions? This is simply a function that returns an integer, albeit one that uses the GIMP UI - which pygimp already can initialise.

Best way to use C functions from Python is to write wrapper module in C
that will export methods as Python functions/classes (just as
GIMP-Python does).
Also you can load shared object and call C-function directly using
libffi library (presented as ctypes module in Python), but this
error-prone and really hackish way.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]