Re: How to call gimp_export_image() from Pythonplugin

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

 



IS it available throught the PDB?
Most GIMP - Python functions are done via PDB, except pixel-region
manipulation stuff.
If it is not in the PDB, it is not availabl in GIMP 2.8 - the current
GIMP Python structure has to
special cases a lot of things to work aside from the PDB, and doing so
is not minor stuff
done inside a release cycle.

Making the 3-4 above calls are straightforward - I see no reason to
violate the principle of no new features inside a release to add this.
In GIMP 2.10, the export feature will also have to deal with precision
management, and besides this export function, a class of PDB calls
dealing with precision needs
to be added as well.

On 18 June 2014 14:21, Ed . <ej_zg@xxxxxxxxxxx> wrote:
> Just to clarify, JS - you say "gimp_export_image is not available to
> plug-ins as of gimp 2.8 series" - I take it you mean to Python plug-ins?
> Because it works fine in Gimp-Perl plug-ins.
>
> I'd claim that the lack of gimp_export_image in pygimp is a bug, not a
> feature to be added, so it should be possible to add in 2.8. Vladimir, it
> ought to be as simple as adding to pygimp gimpexport, in the same way as
> there is gimpui. See
> http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpexport.html
>
> Ed J
> Gimp-Perl guy
>
> -----Original Message----- From: Vladimir Rutsky
> Sent: Wednesday, June 18, 2014 1:27 PM
> To: gwidion@xxxxxxxxx
> Cc: gimp-developer
> Subject: Re:  How to call gimp_export_image() from
> Pythonplugin
>
>
> On Wed, Jun 18, 2014 at 3:19 PM, Joao S. O. Bueno <gwidion@xxxxxxxxx> wrote:
>>
>> On 18 June 2014 07:43, Vladimir Rutsky <rutsky.vladimir@xxxxxxxxx> wrote:
>>>
>>> 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.
>>
>>
>> so, just do the needed conversions through further PDB calls.
>> as you can see, gimp_export_image is not available to plug-ins as of
>> gimp 2.8 series.
>> (yes, it should be, and yes you can open a  bug report requesting that
>> so that we don't  forget about it,
>> but this is an API change, so it will just be there for GIMP 2.10 anyway).
>
>
> Ok, thank you for clarification. I filed bug:
> https://bugzilla.gnome.org/show_bug.cgi?id=731843
>
> Why it can be released sooner? I'm not familiar with GIMP development
> process, but I think exporting additional function doesn't break
> backward compatibility of API.
> If I'll submit patches for this issue, when I can expect to see it in
> some official release of GIMP (in case patches will be accepted)?
>
>
> --
> Vladimir Rutsky
>
>
>
>>
>>
>>    js
>>  -><-
>>
>>>
>>> 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
_______________________________________________
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