Re: How to call gimp_export_image() from Python plugin

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

 



On Wed, Jun 18, 2014 at 7:32 AM, Joao S. O. Bueno <gwidion@xxxxxxxxx> wrote:
> 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
>  -><-

Thank for your reply, but this doesn't solves my problem.

merge_visible_layers() doesn't behave as gimp_export_image(): it only
merges image layers to single layer.
I need not only to merge them, but also to convert to proper image
format suitable for me (e.g. convert to RGB from GRAY or RGBA) and
probably some other convertions.

And gimp_export_image() designed specifically for my task.

According to it's sources
(https://git.gnome.org/browse/gimp/tree/libgimp/gimpexport.c) there
are quite a lot of steps and not so trivial logic that should be done
to obtain result image, and I don't want to reimplement this
functionality, I want to call gimp_export_image().

>
>
>
>
> On 17 June 2014 19:43, Vladimir Rutsky <rutsky.vladimir@xxxxxxxxx> 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@xxxxxxxxx
>> List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
>> List archives:   https://mail.gnome.org/archives/gimp-developer-list


--
Vladimir Rutsky
_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list@xxxxxxxxx
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list




[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux