On 6/15/07, Milos Prudek wrote:
Hi,
I would like to script two simple actions:
1)
- Add frame 20 white pixels,
- Add frame 2 black pixels,
- Add frame 80 white pixels,
- Job finished
2)
- add white blurred frame 110 pixels
- blur the border, grain 9, no added shadow
- Job finished
I would like to do it in Python. Where can I find API calls available in
Python plugin?
--
Milos Prudek
As far as I can see, the pygimp docs are only in the sourcetree of
gimp, not an installation :(.
In the sourcetree, it is in plug-ins/pygimp/doc/; you'll have to
download one of the source archives.
Apart from the specific API provided by pygimp, all the pdb functions
are usable through the pdb object.
A skeleton of a PyGimp plugin follows:
-- cut here --
#!/usr/bin/env python
import gimp,gimpplugin
from gimpfu import PLUGIN, PF_INT, PF_IMAGE, PF_DRAWABLE
# this is the usual thing to do, to make pdb more easy to access
# most plugins would make use of the pdb, though this one doesn't.
pdb = gimp.pdb
class Simple (gimpplugin.plugin):
def query (self):
# I didn't want to bother with specifying author, copyright etc just
for this example,
# so here's a default string to use
d = ''
gimp.install_procedure ('plug_in_simple',
d,d,d,d,d,'/File/Simple_Test', '*',PLUGIN, [(PF_INT,
'run_mode', "run mode"),(PF_IMAGE, 'image', 'Image'), (PF_DRAWABLE,
'drawable', 'Drawable')], [])
# must have class methods corresponding to the pdb entries you register.
# script-fu etc. see this as 'plug-in-simple'
def plug_in_simple (self, run_mode, image, drawable):
return
def start (self):
gimpplugin.plugin.start (self)
def quit (self):
#cleanup here -- usually defining this is unnecessary
pass
if __name__ == '__main__':
Simple ().start ()
-- cut here --
And the pdb is accessible, in brief, like this:
pdb.plug_in_gauss (image, drawable, 9, 9, 1)