On Tue, Sep 20, 2005 at 11:03:55AM +0200, Martin Lesser wrote:
> Is it possible to create images with python-fu but without a GUI?
> I tried
> # PYTHONPATH=/usr/lib/gimp/2.0/python python
> from gimpfu import *
> img = gimp.Image(100, 100, RGB)
> but this results in a glib-error:
>   LibGimpBase-ERROR **: could not find handler for message: 5

As you found out, this won't work. Python-Fu scripts can only be invoked
from GIMP itself.

> How do I tell gimpfu to run in non-interactive mode from command-line or
> other scripts?

Write your script like any other python-fu script, and stick it in the
plug-ins directory:

    #!/usr/bin/env python

    from gimpfu import *

    def do_stuff():
        img = gimp.Image(100, 100, RGB)
        print img

        "<Toolbox>/Xtns/Python-Fu/Do Stuff",


Then invoke from the command line:

$ gimp -i -b '(python-fu-do-stuff 1)' -b '(gimp-quit 0)'

This will create an image and print "<gimp.Image 'Untitled'>" to the
console if successful.

Gimp-user mailing list

Reply via email to