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

From Python, in GIMP 2.8, you have to make calls to whatever is
available via the PDB, but
for some calls that have been shortened as methods of Image, Layer and
other objects (but internally,
most things happen through the PDB anyway).

So, you have to call either "pdb.gimp_file_save"  and specify the file
format via the file-name extension,
or call "pdb.file_bmp_save". For both cases you have to passin a
drawable to be saved, meaning that if you
want to save an existingimage, you hvae to preceed these calls with
the equivalent of these two lines:

saving_image = pdb.gimp_image_duplicate(img)
saving_drawable = pdb.gimp_image_merge_visible_layers(saving_image)

then you have a drawable to save, with all the visible image contents,
but without messing
with the image the user sees. After saving, call
"pdb.gimp_image_delete(saving_image)" - to recover
the resources used by the temporary image,


On 17 June 2014 19:43, Vladimir Rutsky <rutsky vladimir gmail com> wrote:

I'm trying to write export plugin for custom image format in Python.

Looking at plugins implemented in C, e.g. gimp/plug-ins/file-bmp/bmp.c, and
docs (
I see, that best and recommended way to convert user image to single layer
image with proper capabilities is by using gimp_export_image() function.

How gimp_export_image() can be called from Python?

I can't find it exported Python modules and looks like it's not accessible
via PDB either.

If it's not available, can you advice proper alternative? Should I report
missing gimp_export_image() function in bug tracker?

Thanks in advance,

Vladimir Rutsky

gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
List archives:

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