RSS/Atom feed Twitter
Site is read-only, email is disabled

Searching for python scripting tutorial

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Searching for python scripting tutorial Milos Prudek 15 Jun 13:32
  Searching for python scripting tutorial David Gowers 16 Jun 02:50
   Searching for python scripting tutorial Milos Prudek 16 Jun 09:35
Milos Prudek
2007-06-15 13:32:55 UTC (over 17 years ago)

Searching for python scripting tutorial

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?

David Gowers
2007-06-16 02:50:39 UTC (over 17 years ago)

Searching for python scripting tutorial

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)

Milos Prudek
2007-06-16 09:35:33 UTC (over 17 years ago)

Searching for python scripting tutorial

A skeleton of a PyGimp plugin follows:

Thank you!