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,

  js
 -><-




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

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 (http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpexport.html)
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: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list


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